diff --git a/Yavsc/Controllers/CommandController.cs b/Yavsc/Controllers/CommandController.cs index 947e1b77..3a4bfbd5 100644 --- a/Yavsc/Controllers/CommandController.cs +++ b/Yavsc/Controllers/CommandController.cs @@ -134,22 +134,26 @@ 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 && x.Longitude == command.Location.Longitude && x.Latitude == command.Location.Latitude ); diff --git a/Yavsc/Models/Billing/NominatvieCommand.cs b/Yavsc/Models/Billing/NominatvieCommand.cs index 072bca94..8c2bb031 100644 --- a/Yavsc/Models/Billing/NominatvieCommand.cs +++ b/Yavsc/Models/Billing/NominatvieCommand.cs @@ -10,13 +10,13 @@ namespace Yavsc.Models.Billing public class NominativeServiceCommand : Query where T:Service { - + [Required] public string ClientId { get; set; } /// /// The client /// - [Required,ForeignKey("ClientId")] + [ForeignKey("ClientId")] public ApplicationUser Client { get; set; } [Required] diff --git a/Yavsc/Views/Command/Create.cshtml b/Yavsc/Views/Command/Create.cshtml index c70c8a80..cdb9d8c5 100644 --- a/Yavsc/Views/Command/Create.cshtml +++ b/Yavsc/Views/Command/Create.cshtml @@ -178,7 +178,9 @@
- @Html.HiddenFor(model=>model.Location.Latitude) @Html.HiddenFor(model=>model.Location.Longitude) + +@Html.HiddenFor(model=>model.Location.Latitude) + @Html.HiddenFor(model=>model.Location.Longitude)
@@ -191,7 +193,7 @@ -@Html.HiddenFor(model=>model.Client.Id) +@Html.HiddenFor(model=>model.ClientId) @Html.HiddenFor(model=>model.PerformerId) @Html.HiddenFor(model=>model.ActivityCode)