lister ses commandes

en tant que presta ou client
main
Paul Schneider 9 years ago
parent d6465d0de5
commit 8b6dac72e0
1 changed files with 14 additions and 4 deletions

@ -51,14 +51,18 @@ namespace Yavsc.Controllers
}
// GET: Command
[Authorize]
public IActionResult Index()
{
var uid = User.GetUserId();
return View(_context.BookQueries
.Include(x => x.Client)
.Include(x => x.PerformerProfile)
.Include(x => x.PerformerProfile.Performer)
.Include(x => x.Location)
.Include(x => x.Bill).ToList());
.Include(x => x.Bill)
.Where(x=> x.ClientId == uid || x.PerformerId == uid)
.ToList());
}
// GET: Command/Details/5
@ -138,13 +142,19 @@ namespace Yavsc.Controllers
command.Client = user;
if (ModelState.IsValid)
{
var yaev = command.CreateEvent(_localizer);
MessageWithPayloadResponse grep = null;
var existingLocation = _context.Locations.FirstOrDefault( x=>x.Address == command.Location.Address
&& x.Longitude == command.Location.Longitude && x.Latitude == command.Location.Latitude );
_context.Attach<Location>(command.Location);
if (existingLocation!=null) {
command.Location=existingLocation;
}
else _context.Attach<Location>(command.Location);
_context.BookQueries.Add(command, GraphBehavior.IncludeDependents);
_context.SaveChanges();
var yaev = command.CreateEvent(_localizer);
MessageWithPayloadResponse grep = null;
if (pro.AcceptNotifications
&& pro.AcceptPublicContact)
{

Loading…