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 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); }
private HolidayRequestResponse Map(HolidayRequestResult x) { return(new HolidayRequestResponse { Approved = x.Approved, Errors = new string[0], Deleted = x.Deleted, Id = x.Id, Success = true, ApproverEmail = x.ApproverEmail, DateFrom = x.DateFrom, DateTo = x.DateTo, UserEmail = x.UserEmail }); }