diff --git a/Yavsc/Controllers/Haircut/HairCutCommandController.cs b/Yavsc/Controllers/Haircut/HairCutCommandController.cs index 61840510..9051852a 100644 --- a/Yavsc/Controllers/Haircut/HairCutCommandController.cs +++ b/Yavsc/Controllers/Haircut/HairCutCommandController.cs @@ -248,10 +248,6 @@ Le client final: {clientFinal} x => x.PerformerId == model.PerformerId ); model.PerformerProfile = pro; - // FIXME Why!! - // ModelState.ClearValidationState("PerformerProfile.Avatar"); - // ModelState.ClearValidationState("Client.Avatar"); - // ModelState.ClearValidationState("ClientId"); if (!model.Consent) ModelState.AddModelError("Consent", "Vous devez accepter les conditions générales de vente de ce service"); @@ -259,29 +255,29 @@ Le client final: {clientFinal} if (ModelState.IsValid) { // Une prestation pour enfant ou homme inclut toujours la coupe. - if (model.Prestation.Gender != HairCutGenders.Women) - model.Prestation.Cut = true; - if (model.Location!=null) { - var existingLocation = await _context.Locations.FirstOrDefaultAsync( x=>x.Address == model.Location.Address - && x.Longitude == model.Location.Longitude && x.Latitude == model.Location.Latitude ); - - if (existingLocation!=null) { - model.Location=existingLocation; - } - else _context.Attach(model.Location); + if (model.Prestation.Gender != HairCutGenders.Women) + model.Prestation.Cut = true; + if (model.Location!=null) { + var existingLocation = await _context.Locations.FirstOrDefaultAsync( x=>x.Address == model.Location.Address + && x.Longitude == model.Location.Longitude && x.Latitude == model.Location.Latitude ); + + if (existingLocation!=null) { + model.Location=existingLocation; } - var existingPrestation = await _context.HairPrestation.FirstOrDefaultAsync( x=> model.PrestationId == x.Id ); + else _context.Attach(model.Location); + } + var existingPrestation = await _context.HairPrestation.FirstOrDefaultAsync( x=> model.PrestationId == x.Id ); - if (existingPrestation!=null) { - model.Prestation = existingPrestation; - } - else _context.Attach(model.Prestation); + if (existingPrestation!=null) { + model.Prestation = existingPrestation; + } + else _context.Attach(model.Prestation); _context.HairCutQueries.Add(model); - await _context.SaveChangesAsync(uid); var brusherProfile = await _context.BrusherProfile.SingleAsync(p=>p.UserId == pro.PerformerId); model.Client = await _context.Users.SingleAsync(u=>u.Id == model.ClientId); model.SelectedProfile = brusherProfile; + await _context.SaveChangesAsync(uid); var yaev = model.CreateNewHairCutQueryEvent(_localizer); MessageWithPayloadResponse grep = null; diff --git a/Yavsc/Startup/Startup.SanityChecks.cs b/Yavsc/Startup/Startup.SanityChecks.cs index 85f50970..744dfb2f 100644 --- a/Yavsc/Startup/Startup.SanityChecks.cs +++ b/Yavsc/Startup/Startup.SanityChecks.cs @@ -29,7 +29,7 @@ namespace Yavsc if (appData == null) { if (SiteSetup.DataDir == null) { - SiteSetup.DataDir = "AppData"; + SiteSetup.DataDir = "AppData"+env.EnvironmentName; } else logger.LogWarning("existing setting: "+SiteSetup.DataDir); DirectoryInfo di = new DirectoryInfo(SiteSetup.DataDir); if (!di.Exists)