public async Task <IActionResult> Edit(int id, [Bind("Id,Quarter,Year,MarkQuarter,MarkYear,EmployeeId")] ListEmployeesMetrics listEmployeesMetrics) { if (id != listEmployeesMetrics.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(listEmployeesMetrics); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ListEmployeesMetricsExists(listEmployeesMetrics.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["EmployeeId"] = new SelectList(_context.Employees, "Id", "FullName", listEmployeesMetrics.EmployeeId); return(View(listEmployeesMetrics)); }
public async Task <IActionResult> Create([Bind("Id,Quarter,Year,MarkQuarter,MarkYear,EmployeeId")] ListEmployeesMetrics listEmployeesMetrics) { if (ModelState.IsValid) { _context.Add(listEmployeesMetrics); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["EmployeeId"] = new SelectList(_context.Employees, "Id", "FullName", listEmployeesMetrics.EmployeeId); return(View(listEmployeesMetrics)); }