Fixes command since Avatar is required

This commit is contained in:
2017-02-04 16:33:48 +01:00
parent 21ec2f40b3
commit 12ba997c0e
3 changed files with 18 additions and 12 deletions

View File

@ -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 );