public ActionResult Create(Employee employee, HttpPostedFileBase image) { if (ModelState.IsValid) { employee.CreateFileForContainer(image); _repository.CreateEmployee(employee); TempData.AddMessage(MessageType.Success, string.Format(GlobalRes.EmployeeSavedMsg, employee.FullName)); _logger.Info("Employee \"{0}\" created by {1}.", employee.FullName, User.Identity.Name); return RedirectToAction(nameof(Table), new { area = "Admin" }); } else { // there is something wrong with the data values return View("CreateEmployee", employee); } }
public void UpdateEmployee(Employee employee) { _context.Entry(employee).State = EntityState.Modified; _context.SaveChanges(); }
public void CreateEmployee(Employee employee) { _context.Employees.Add(employee); _context.SaveChanges(); }