public async Task <IActionResult> Edit(int id, [Bind("Id,DateCreated,Author,Content,EmployeeId")] Comment comment) { if (id != comment.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(comment); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CommentExists(comment.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index", "Comments", new { Id = comment.EmployeeId })); } return(View(comment)); }
public async Task <IActionResult> Edit(string id, [Bind("Id,MachineName,Status,Data")] Machine machine) { if (id != machine.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(machine); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MachineExists(machine.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(machine)); }
public async Task <IActionResult> Edit(Guid id, [Bind("Id,Name,Data,Status")] Device device) { if (id != device.Id) { return(NotFound()); } if (ModelState.IsValid) { try { db.Update(device); await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DeviceExists(device.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(device)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,JoinedDate,Name,JobTitle,MonthlySalary,Department,ManagerId")] Employee employee) { if (id != employee.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(employee); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmployeeExists(employee.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ManagerId"] = new SelectList(_context.Employees, "Id", "Name", employee.ManagerId); return(View(employee)); }