Exemplo n.º 1
0
 public ActionResult UpdateLeave(InstructorLeaveModel updateLeave)
 {
     if (ModelState.IsValid)
     {
         var currentUser = Request.GetOwinContext().Authentication.User.Identity.GetUserId();
         _instructorRepo.UpdateInstructorLeave(currentUser, updateLeave);
         return View("InstructorLeaves");
     }
     return View();
 }
Exemplo n.º 2
0
        public ActionResult NewLeaveByInstructor(InstructorLeaveModel appliedLeave)
        {
            if (ModelState.IsValid)
            {
                var currentUser = Request.GetOwinContext().Authentication.User.Identity.GetUserId();
                _instructorRepo.ApplyInstructorLeave(currentUser, appliedLeave);
                return View("InstructorLeaves");
            }

            return View();
        }
Exemplo n.º 3
0
 public void UpdateInstructorLeave(string currentUser, InstructorLeaveModel updateLeave)
 {
     var appliedDetails = DataContext.Instructor_Leaves.FirstOrDefault(s => s.Id == updateLeave.Id) ?? new Instructor_Leaves();
     appliedDetails.InstructorId = currentUser;
     appliedDetails.Reason = updateLeave.LeaveReason;
     appliedDetails.StartDate = updateLeave.StartDate;
     appliedDetails.EndDate = updateLeave.EndDate;
     appliedDetails.StartTime = updateLeave.StartTime;
     appliedDetails.EndTime = updateLeave.StopTime;
     appliedDetails.ModifiedDate = DateTime.Now;
     appliedDetails.ModifiedBy = currentUser;
     appliedDetails.StartTime = updateLeave.StartTime;
     appliedDetails.EndTime = updateLeave.StopTime;
     if (appliedDetails.Id == 0)
     {
         appliedDetails.CreatedDate = DateTime.Now;
         appliedDetails.CreatedBy = currentUser;
         DataContext.Instructor_Leaves.Add(appliedDetails);
     }
     SaveInDatabase();
 }
Exemplo n.º 4
0
 public ActionResult NewLeaveByInstructor(string instructorId)
 {
     var model = new InstructorLeaveModel
     {
         StartTime = new TimeSpan(0,0,0),
         StopTime = new TimeSpan(23,59,0)
     };
     return View(model);
 }
Exemplo n.º 5
0
 public void ApplyInstructorLeave(string userId, InstructorLeaveModel appliedLeave)
 {
     var appliedDetails = DataContext.Instructor_Leaves.FirstOrDefault(s => s.Id == appliedLeave.Id) ?? new Instructor_Leaves();
     appliedDetails.InstructorId = userId;
     appliedDetails.Reason = appliedLeave.LeaveReason;
     appliedDetails.StartDate = appliedLeave.StartDate;
     appliedDetails.EndDate = appliedLeave.EndDate;
     appliedDetails.StartTime = appliedLeave.StartTime;
     appliedDetails.EndTime = appliedLeave.StopTime;
     appliedDetails.ModifiedDate = DateTime.Now;
     appliedDetails.ModifiedBy = userId;
     if (appliedDetails.Id == 0)
     {
         appliedDetails.CreatedDate = DateTime.Now;
         appliedDetails.CreatedBy = userId;
         DataContext.Instructor_Leaves.Add(appliedDetails);
     }
     SaveInDatabase();
 }