コード例 #1
0
        public ActionResult SubmitTimeSheet()
        {
            var model = new TimeTrackerVM();

            model.EmployeeInfo = GenerateEmployeeList();
            return(View(model));
        }
コード例 #2
0
        // GET: TimeTracker
        public ActionResult SelectEmpToView()
        {
            var model = new TimeTrackerVM();

            model.EmployeeInfo = GenerateEmployeeList();

            return(View(model));
        }
コード例 #3
0
        public List <SelectListItem> GenerateEmployeeList()
        {
            var ops = new TimeTrackerOperations();
            List <SelectListItem>       selectItemList = new List <SelectListItem>();
            Response <List <Employee> > employees      = ops.GetAllEmployees();
            var model = new TimeTrackerVM();

            model.DisplayEmployeeInformation(employees.Data);
            selectItemList = model.EmployeeInfo;
            return(selectItemList);
        }
コード例 #4
0
        public ActionResult SubmitTimeSheet(TimeTrackerVM model)
        {
            if (ModelState.IsValidField("NewTimesheet.TotalHoursByDay") &&
                (DateTime.Now > model.NewTimesheet.DateOfTimesheet) &&
                (model.NewTimesheet.DateOfTimesheet > new DateTime(2005, 08, 07)))
            {
                var ops = new TimeTrackerOperations();
                model.NewTimesheet.EmpId = model.SelectedEmployee.EmpID;
                ops.SubmitTimeSheet(model.NewTimesheet);


                return(RedirectToAction("TimeTrackerSummary", new { empId = model.NewTimesheet.EmpId }));
            }
            ModelState.AddModelError("NewTimesheet.DateOfTimesheet", "That is an invalid date");
            model.EmployeeInfo = GenerateEmployeeList();
            return(View(model));
        }
コード例 #5
0
 public ActionResult SelectEmpToView(TimeTrackerVM model)
 {
     return(RedirectToAction("TimeTrackerSummary", new { empId = model.SelectedEmployee.EmpID }));
 }