public ActionResult Edit(int id, FormCollection collection) { try { // TODO: Add update logic here var model = EmployeeExit.GetById(id); TryUpdateModel(model); model.SaveOrUpDate(); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create(FormCollection collection) { try { // TODO: Add insert logic here var model = new EmployeeExit(); TryUpdateModel(model); model.CreatedAt = DateTime.Now; model.CreatedBy = SessionItems.CurrentUser.UserID; model.Insert(); return(RedirectToAction("Index")); } catch { return(View()); } }
/// <summary> /// Saves the employee exit information. /// </summary> /// <param name="employeeExitInfo">The employee exit information.</param> /// <returns></returns> /// <exception cref="ArgumentNullException">employeeExitInfo</exception> public string SaveEmployeeExitInfo(IEmployeeExitView employeeExitInfo) { if (employeeExitInfo == null) { throw new ArgumentNullException(nameof(employeeExitInfo)); } var result = string.Empty; var newRecord = new EmployeeExit { CompanyId = employeeExitInfo.CompanyId, EmployeeId = employeeExitInfo.EmployeeId, DateCreated = DateTime.Now, IsActive = true, Reason = employeeExitInfo.Reason, Interviewer = employeeExitInfo.Interviewer, TypeOfExitId = employeeExitInfo.TypeOfExitId, InterviewDate = employeeExitInfo.InterviewDate, DateRequested = employeeExitInfo.DateRequested, ExitInterViewSummary = employeeExitInfo.ExitInterViewSummary }; try { using ( var dbContext = (HRMSEntities)this.dbContextFactory.GetDbContext(ObjectContextType.HRMS)) { var employee = dbContext.Employees.SingleOrDefault(p => p.EmployeeId.Equals(employeeExitInfo.EmployeeId)); employee.IsExit = true; dbContext.EmployeeExits.Add(newRecord); dbContext.SaveChanges(); } } catch (Exception e) { result = string.Format("SaveEmployeeExitInfo - {0} , {1}", e.Message, e.InnerException != null ? e.InnerException.Message : ""); } return(result); }
// GET: EmployeeExit/Edit/5 public ActionResult Edit(int id) { return(View(EmployeeExit.GetById(id))); }
// GET: EmployeeExit public ActionResult Index() { return(View(EmployeeExit.GetAll())); }