Fixes command since Avatar is required
This commit is contained in:
@ -134,22 +134,26 @@ namespace Yavsc.Controllers
|
|||||||
if (string.IsNullOrWhiteSpace(uid)
|
if (string.IsNullOrWhiteSpace(uid)
|
||||||
|| string.IsNullOrWhiteSpace(prid))
|
|| string.IsNullOrWhiteSpace(prid))
|
||||||
throw new InvalidOperationException(
|
throw new InvalidOperationException(
|
||||||
"This method needs a prid and uid"
|
"This method needs a PerformerId"
|
||||||
);
|
);
|
||||||
var pro = _context.Performers.Include(
|
var pro = _context.Performers.Include(
|
||||||
u => u.Performer
|
u => u.Performer
|
||||||
).Include( u => u.Performer.Devices)
|
).Include(u => u.Performer.Devices)
|
||||||
.FirstOrDefault(
|
.FirstOrDefault(
|
||||||
x => x.PerformerId == command.PerformerId
|
x => x.PerformerId == command.PerformerId
|
||||||
);
|
);
|
||||||
_logger.LogDebug($"Pro: {pro}");
|
var user = await _userManager.FindByIdAsync(uid);
|
||||||
command.PerformerProfile = pro;
|
|
||||||
var user = await _userManager.FindByIdAsync(
|
|
||||||
User.GetUserId()
|
|
||||||
);
|
|
||||||
command.Client = user;
|
command.Client = user;
|
||||||
|
command.ClientId = uid;
|
||||||
|
command.PerformerProfile = pro;
|
||||||
|
// FIXME Why!!
|
||||||
|
// ModelState.ClearValidationState("PerformerProfile.Avatar");
|
||||||
|
// ModelState.ClearValidationState("Client.Avatar");
|
||||||
|
// ModelState.ClearValidationState("ClientId");
|
||||||
|
ModelState.MarkFieldSkipped("ClientId");
|
||||||
|
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
var existingLocation = _context.Locations.FirstOrDefault( x=>x.Address == command.Location.Address
|
var existingLocation = _context.Locations.FirstOrDefault( x=>x.Address == command.Location.Address
|
||||||
&& x.Longitude == command.Location.Longitude && x.Latitude == command.Location.Latitude );
|
&& x.Longitude == command.Location.Longitude && x.Latitude == command.Location.Latitude );
|
||||||
|
|
||||||
|
@ -10,13 +10,13 @@ namespace Yavsc.Models.Billing
|
|||||||
|
|
||||||
public class NominativeServiceCommand<T> : Query<T> where T:Service
|
public class NominativeServiceCommand<T> : Query<T> where T:Service
|
||||||
{
|
{
|
||||||
|
[Required]
|
||||||
public string ClientId { get; set; }
|
public string ClientId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The client
|
/// The client
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required,ForeignKey("ClientId")]
|
[ForeignKey("ClientId")]
|
||||||
public ApplicationUser Client { get; set; }
|
public ApplicationUser Client { get; set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
|
@ -178,7 +178,9 @@
|
|||||||
<div class='col-sm-6'>
|
<div class='col-sm-6'>
|
||||||
<div id='reason1'>
|
<div id='reason1'>
|
||||||
<textarea rows="15" asp-for="Reason" type="text" name="Reason" id="Reason" maxlength="4096" class="form-control"></textarea>
|
<textarea rows="15" asp-for="Reason" type="text" name="Reason" id="Reason" maxlength="4096" class="form-control"></textarea>
|
||||||
<span asp-validation-for="Reason" class="text-danger"></span> @Html.HiddenFor(model=>model.Location.Latitude) @Html.HiddenFor(model=>model.Location.Longitude)
|
<span asp-validation-for="Reason" class="text-danger"></span>
|
||||||
|
@Html.HiddenFor(model=>model.Location.Latitude)
|
||||||
|
@Html.HiddenFor(model=>model.Location.Longitude)
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -191,7 +193,7 @@
|
|||||||
<input type="submit" value="@SR[" Create "]" class="btn btn-default" />
|
<input type="submit" value="@SR[" Create "]" class="btn btn-default" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@Html.HiddenFor(model=>model.Client.Id)
|
@Html.HiddenFor(model=>model.ClientId)
|
||||||
@Html.HiddenFor(model=>model.PerformerId)
|
@Html.HiddenFor(model=>model.PerformerId)
|
||||||
@Html.HiddenFor(model=>model.ActivityCode)
|
@Html.HiddenFor(model=>model.ActivityCode)
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user