public HolidayRequestResult UpdateResourceHolidayRequestStatus(ApproveRequestViewModel model, int userId) { var request = GetResourceHolidayRequestById(model.ResourceHolidayRequestId); request.UpdatedBy = userId; request.DateUpdated = DateTime.UtcNow; var response = new HolidayRequestResult();; if (model.IsApproved) { request.RequestStatus = ResourceRequestStatusEnum.Accepted; request.ActionedBy = userId; request.ActionReason = null; _currentDbContext.Entry(request).State = EntityState.Modified; _currentDbContext.SaveChanges(); return(new HolidayRequestResult()); } else { request.ActionReason = model.Reason; request.RequestStatus = ResourceRequestStatusEnum.Declined; _currentDbContext.Entry(request).State = EntityState.Modified; _currentDbContext.SaveChanges(); } response.HasWarning = false; return(response); }
public ActionResult WarningBeforeApprove(ApproveRequestViewModel model) { if (model.ResourceHolidayRequestId != 0) { var result = _employeeServices.CountResourceHolidayRequestStatus(model, CurrentUserId); return(Json(result, JsonRequestBehavior.AllowGet)); } return(Json(false, JsonRequestBehavior.AllowGet)); }
public HolidayRequestResult CountResourceHolidayRequestStatus(ApproveRequestViewModel model, int userId) { var request = GetResourceHolidayRequestById(model.ResourceHolidayRequestId); var response = new HolidayRequestResult();; response = _resourceHolidayServices.VerifyHolidayList(model.ResourceHolidayRequestId, request.ResourceId, request.StartDate.Value, request.EndDate, request.EventType); return(response); }
public ActionResult Approve(ApproveRequestViewModel model) { var result = _employeeServices.UpdateResourceHolidayRequestStatus(model, CurrentUserId); return(Json(result, JsonRequestBehavior.AllowGet)); }