public ActionResult Edit(LeavePlan leaveplan) { if (ModelState.IsValid) { TimesheetRepository.AddUpdateLeavePlan(leaveplan); return(RedirectToAction("Index")); } ViewBag.LeaveCategoryId = new SelectList(TimesheetRepository.GetLeaveCategories(), "LeaveCategoryId", "LeaveCategoryDesc", leaveplan.LeaveCategoryId); ViewBag.PersonId = new SelectList(TimesheetRepository.GetAllPersons(), "PersonId", "PersonName", leaveplan.PersonId); return(View(leaveplan)); }