public ActionResult SubmitTimeSheet() { var model = new TimeTrackerVM(); model.EmployeeInfo = GenerateEmployeeList(); return(View(model)); }
// GET: TimeTracker public ActionResult SelectEmpToView() { var model = new TimeTrackerVM(); model.EmployeeInfo = GenerateEmployeeList(); return(View(model)); }
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); }
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)); }
public ActionResult SelectEmpToView(TimeTrackerVM model) { return(RedirectToAction("TimeTrackerSummary", new { empId = model.SelectedEmployee.EmpID })); }