// // GET: /TimeSheetMaster/Create public ActionResult Create() { ViewBag.PersonId = new SelectList(TimesheetRepository.GetAllPersons(), "PersonId", "PersonName"); ViewBag.SupervisorId = new SelectList(TimesheetRepository.GetAllSupervisors(), "PersonId", "PersonName"); ViewBag.CompanyId = new SelectList(TimesheetRepository.GetAllCompanies(), "CompanyId", "CompanyDescription"); return(View()); }
public ActionResult Create(TimeSheetMaster master) { if (ModelState.IsValid) { TimeSheetMaster newMaster = master; newMaster.Save(); return(RedirectToAction("Index")); } ViewBag.PersonId = new SelectList(TimesheetRepository.GetAllPersons(), "PersonId", "PersonName"); ViewBag.ManagerId = new SelectList(TimesheetRepository.GetAllSupervisors(), "PersonId", "PersonName"); ViewBag.CompanyId = new SelectList(TimesheetRepository.GetAllCompanies(), "CompanyId", "CompanyDescription"); return(View(master)); }