|
|
@ -229,6 +229,7 @@ Le client final: {clientFinal}
|
|
|
|
// TODO utiliser Markdown-av+tags
|
|
|
|
// TODO utiliser Markdown-av+tags
|
|
|
|
var uid = User.GetUserId();
|
|
|
|
var uid = User.GetUserId();
|
|
|
|
var prid = model.PerformerId;
|
|
|
|
var prid = model.PerformerId;
|
|
|
|
|
|
|
|
var brusherProfile = await _context.BrusherProfile.SingleAsync(p => p.UserId == prid);
|
|
|
|
long[] longtaintIds = null;
|
|
|
|
long[] longtaintIds = null;
|
|
|
|
List<HairTaint> colors = null;
|
|
|
|
List<HairTaint> colors = null;
|
|
|
|
|
|
|
|
|
|
|
@ -246,52 +247,52 @@ Le client final: {clientFinal}
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_logger.LogInformation("le Model _est_ valide.");
|
|
|
|
_logger.LogInformation("le Model _est_ valide.");
|
|
|
|
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 == model.PerformerId
|
|
|
|
x => x.PerformerId == model.PerformerId
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (taintIds != null)
|
|
|
|
if (taintIds != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
longtaintIds = taintIds.Split(',').Select(s => long.Parse(s)).ToArray();
|
|
|
|
longtaintIds = taintIds.Split(',').Select(s => long.Parse(s)).ToArray();
|
|
|
|
colors = _context.HairTaint.Where(t => longtaintIds.Contains(t.Id)).ToList();
|
|
|
|
colors = _context.HairTaint.Where(t => longtaintIds.Contains(t.Id)).ToList();
|
|
|
|
// a Prestation is required
|
|
|
|
// a Prestation is required
|
|
|
|
model.Prestation.Taints = colors.Select(c =>
|
|
|
|
model.Prestation.Taints = colors.Select(c =>
|
|
|
|
new HairTaintInstance { Taint = c }).ToList();
|
|
|
|
new HairTaintInstance { Taint = c }).ToList();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Une prestation pour enfant ou homme inclut toujours la coupe.
|
|
|
|
// Une prestation pour enfant ou homme inclut toujours la coupe.
|
|
|
|
if (model.Prestation.Gender != HairCutGenders.Women)
|
|
|
|
if (model.Prestation.Gender != HairCutGenders.Women)
|
|
|
|
model.Prestation.Cut = true;
|
|
|
|
model.Prestation.Cut = true;
|
|
|
|
if (model.Location != null)
|
|
|
|
if (model.Location != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var existingLocation = await _context.Locations.FirstOrDefaultAsync(x => x.Address == model.Location.Address
|
|
|
|
var existingLocation = await _context.Locations.FirstOrDefaultAsync(x => x.Address == model.Location.Address
|
|
|
|
&& x.Longitude == model.Location.Longitude && x.Latitude == model.Location.Latitude);
|
|
|
|
&& x.Longitude == model.Location.Longitude && x.Latitude == model.Location.Latitude);
|
|
|
|
|
|
|
|
|
|
|
|
if (existingLocation != null)
|
|
|
|
if (existingLocation != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
model.Location = existingLocation;
|
|
|
|
model.Location = existingLocation;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else _context.Attach<Location>(model.Location);
|
|
|
|
else _context.Attach<Location>(model.Location);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var existingPrestation = await _context.HairPrestation.FirstOrDefaultAsync(x => model.PrestationId == x.Id);
|
|
|
|
var existingPrestation = await _context.HairPrestation.FirstOrDefaultAsync(x => model.PrestationId == x.Id);
|
|
|
|
|
|
|
|
|
|
|
|
if (existingPrestation != null)
|
|
|
|
if (existingPrestation != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
model.Prestation = existingPrestation;
|
|
|
|
model.Prestation = existingPrestation;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else _context.Attach<HairPrestation>(model.Prestation);
|
|
|
|
else _context.Attach<HairPrestation>(model.Prestation);
|
|
|
|
|
|
|
|
|
|
|
|
_context.HairCutQueries.Add(model);
|
|
|
|
_context.HairCutQueries.Add(model);
|
|
|
|
var brusherProfile = await _context.BrusherProfile.SingleAsync(p => p.UserId == pro.PerformerId);
|
|
|
|
|
|
|
|
|
|
|
|
await _context.SaveChangesAsync(uid);
|
|
|
|
await _context.SaveChangesAsync(uid);
|
|
|
|
|
|
|
|
_logger.LogInformation("la donnée _est_ sauvée.");
|
|
|
|
_logger.LogInformation("la donnée _est_ sauvée.");
|
|
|
|
|
|
|
|
|
|
|
|
var yaev = model.CreateNewHairCutQueryEvent(_localizer);
|
|
|
|
|
|
|
|
MessageWithPayloadResponse grep = null;
|
|
|
|
MessageWithPayloadResponse grep = null;
|
|
|
|
|
|
|
|
model.SelectedProfile = brusherProfile;
|
|
|
|
|
|
|
|
var yaev = model.CreateNewHairCutQueryEvent(_localizer);
|
|
|
|
|
|
|
|
|
|
|
|
if (pro.AcceptPublicContact)
|
|
|
|
if (pro.AcceptPublicContact)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -344,6 +345,7 @@ Le client final: {clientFinal}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ViewBag.Activity = _context.Activities.FirstOrDefault(a => a.Code == model.ActivityCode);
|
|
|
|
ViewBag.Activity = _context.Activities.FirstOrDefault(a => a.Code == model.ActivityCode);
|
|
|
|
ViewBag.GoogleSettings = _googleSettings;
|
|
|
|
ViewBag.GoogleSettings = _googleSettings;
|
|
|
|
|
|
|
|
model.SelectedProfile = brusherProfile;
|
|
|
|
SetViewData(model.ActivityCode, model.PerformerId, model.Prestation);
|
|
|
|
SetViewData(model.ActivityCode, model.PerformerId, model.Prestation);
|
|
|
|
return View("HairCut", model);
|
|
|
|
return View("HairCut", model);
|
|
|
|
}
|
|
|
|
}
|
|
|
|