Fixes command since Avatar is required
This commit is contained in:
@ -134,20 +134,24 @@ namespace Yavsc.Controllers
|
||||
if (string.IsNullOrWhiteSpace(uid)
|
||||
|| string.IsNullOrWhiteSpace(prid))
|
||||
throw new InvalidOperationException(
|
||||
"This method needs a prid and uid"
|
||||
"This method needs a PerformerId"
|
||||
);
|
||||
var pro = _context.Performers.Include(
|
||||
u => u.Performer
|
||||
).Include( u => u.Performer.Devices)
|
||||
).Include(u => u.Performer.Devices)
|
||||
.FirstOrDefault(
|
||||
x => x.PerformerId == command.PerformerId
|
||||
);
|
||||
_logger.LogDebug($"Pro: {pro}");
|
||||
command.PerformerProfile = pro;
|
||||
var user = await _userManager.FindByIdAsync(
|
||||
User.GetUserId()
|
||||
);
|
||||
var user = await _userManager.FindByIdAsync(uid);
|
||||
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)
|
||||
{
|
||||
var existingLocation = _context.Locations.FirstOrDefault( x=>x.Address == command.Location.Address
|
||||
|
@ -10,13 +10,13 @@ namespace Yavsc.Models.Billing
|
||||
|
||||
public class NominativeServiceCommand<T> : Query<T> where T:Service
|
||||
{
|
||||
|
||||
[Required]
|
||||
public string ClientId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The client
|
||||
/// </summary>
|
||||
[Required,ForeignKey("ClientId")]
|
||||
[ForeignKey("ClientId")]
|
||||
public ApplicationUser Client { get; set; }
|
||||
|
||||
[Required]
|
||||
|
@ -178,7 +178,9 @@
|
||||
<div class='col-sm-6'>
|
||||
<div id='reason1'>
|
||||
<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>
|
||||
@ -191,7 +193,7 @@
|
||||
<input type="submit" value="@SR[" Create "]" class="btn btn-default" />
|
||||
</div>
|
||||
</div>
|
||||
@Html.HiddenFor(model=>model.Client.Id)
|
||||
@Html.HiddenFor(model=>model.ClientId)
|
||||
@Html.HiddenFor(model=>model.PerformerId)
|
||||
@Html.HiddenFor(model=>model.ActivityCode)
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user