示例#1
0
        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);
            }
        }
示例#2
0
 public void UpdateEmployee(Employee employee)
 {
     _context.Entry(employee).State = EntityState.Modified;
     _context.SaveChanges();
 }
示例#3
0
 public void CreateEmployee(Employee employee)
 {
     _context.Employees.Add(employee);
     _context.SaveChanges();
 }