public async Task <IActionResult> Edit(long id, [Bind("Id,Arrival,Leave")] LocalUse localUse) { if (id != localUse.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(localUse); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LocalUseExists(localUse.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(localUse)); }
public async Task <IActionResult> Create([Bind("Id,Arrival,Leave")] LocalUse localUse) { if (ModelState.IsValid) { _context.Add(localUse); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(localUse)); }
public async Task <JsonResult> AssingEntrance(long localId, long personId) { var booking = _context.DbBookings.Include(x => x.Person).Include(x => x.Local).FirstOrDefault(x => x.Person.Id == personId && x.Local.Id == localId); if (booking != null) { var use = new LocalUse() { Booking = booking, Arrival = DateTime.Now, Leave = DateTime.Now }; _context.Add(use); _context.SaveChanges(); } return(Json("")); }