// // GET: /DisciplineRecord/Create public ActionResult Create() { if (HttpContext.Session["UserId"] == null) { return RedirectToAction("Login", "Login"); } DisciplinaryRecordViewModel disciplineModel = new DisciplinaryRecordViewModel(); disciplineModel.EmployeeList = dropRepo.EmployeesDrop(); disciplineModel.ApproverList = dropRepo.ApproverDropDown(); disciplineModel.ActionList = dropRepo.ActionDropDown(); return View(disciplineModel); }
public ActionResult Create(DisciplinaryRecordViewModel modelObj) { try { if (HttpContext.Session["UserId"] == null) { return RedirectToAction("Login", "Login"); } // TODO: Add insert logic here disciplineObj.AddnewRecord(modelObj); return RedirectToAction("Index"); } catch { return View(); } }
public void AddnewRecord(DisciplinaryRecordViewModel modelObj) { tblDisciplinaryRecord newRecord = new tblDisciplinaryRecord() { actionId = modelObj.actionId, approverId = modelObj.approverId, recordId = modelObj.recordId, Reason = modelObj.Reason_Explanation, DateofRecord = modelObj.date, employeeId = modelObj.employeeId, noofdays = modelObj.NoofDays }; entity.tblDisciplinaryRecords.Add(newRecord); entity.SaveChanges(); }