コード例 #1
0
        //
        // 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());
        }
コード例 #2
0
 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));
 }