Example #1
0
        public ActionResult Edit(string shiftId, bool isCalendarView)
        {
            try
            {
                var lstEmployee = employeeServices.GetAllEmployeeOrderByPosition();

                var shift = shiftServices.GetShiftById(shiftId);

                var shiftVM = new AddShiftVM()
                {
                    IsCalendarView                = isCalendarView,
                    ShiftId                       = shift.ShiftId,
                    DateOfShift                   = shift.StartTime.Date,
                    ListEmployees                 = lstEmployee,
                    AssignedShiftEmployeeId       = shift.EmployeeId,
                    AssignedShiftEmployeeFullName = shift.FullName,
                    ShiftStartAt                  = shift.StartTime.ToShortTimeString(),
                    ShiftEndAt                    = shift.EndTime.ToShortTimeString()
                };

                return(PartialView("_Add_Edit_Shift", shiftVM));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public ActionResult Create(string shiftId)
        {
            try
            {
                var shift = shiftServices.GetShiftById(shiftId);

                var requestDayOffVM = new AddDayOffRequestVM
                {
                    ShiftId      = shiftId,
                    DateOfShift  = shift.StartTime.Date,
                    ShiftStartAt = shift.StartTime.ToShortTimeString(),
                    ShiftEndAt   = shift.EndTime.ToShortTimeString()
                };

                return(PartialView("_Create_Day_Off_Request", requestDayOffVM));
            }
            catch (Exception ex)
            {
                var userInfo = CookieHelpers.GetUserInfo();
                return(Redirect(string.Format("/Shift/EmployeeView?empId={0}", userInfo.EmployeeId)));
            }
        }
        //GET: Shift/Details/{id}
        public ActionResult Details(int id)
        {
            ShiftDetail model = service.GetShiftById(id);

            return(View(model));
        }