public async Task <IActionResult> EditInspectionSpace(int id, [Bind("Id,Name,Closed")] InspectionSpace inspectionSpace) { if (id != inspectionSpace.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(inspectionSpace); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InspectionSpaceExists(inspectionSpace.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(inspectionSpace)); }
public async Task <IActionResult> Create([Bind("Id,Name,Closed")] InspectionSpace inspectionSpace) { if (ModelState.IsValid) { _context.Add(inspectionSpace); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(inspectionSpace)); }