public async Task <IActionResult> Edit(int id, [Bind("Id,Attendant,Comment,DepartmentId,DocumentNumber,Name,Organization,Patronymic,Surname")] qvHotEntrance qvHotEntrance) { if (id != qvHotEntrance.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(qvHotEntrance); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!qvHotEntranceExists(qvHotEntrance.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["DepartmentId"] = new SelectList(_context.Departments, "Id", "Department", qvHotEntrance.DepartmentId); return(View(qvHotEntrance)); }
public async Task <IActionResult> Create([Bind("Id,Attendant,Comment,DepartmentId,DocumentNumber,Name,Organization,Patronymic,Surname")] qvHotEntrance qvHotEntrance) { if (ModelState.IsValid) { _context.Add(qvHotEntrance); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewData["DepartmentId"] = new SelectList(_context.Departments, "Id", "Department", qvHotEntrance.DepartmentId); return(View(qvHotEntrance)); }