public IActionResult GetSubstituteAvailabilitySummary([FromBody] SubstituteAvailability model)
 {
     try
     {
         var summary = new List <SubstituteAvailabilitySummary>();
         summary = _service.GetSubstituteAvailabilitySummary(model).ToList();
         return(Ok(summary));
     }
     catch (Exception ex)
     {
     }
     finally
     {
     }
     return(null);
 }
        public IActionResult GetSubstituteAvailability([FromBody] SubstituteAvailability model)
        {
            try
            {
                if (model == null)
                {
                    model = new SubstituteAvailability {
                        StartDate = DateTime.Now, AvailabilityStatusId = -1, UserId = ""
                    };
                }

                model.DistrictId = base.CurrentUser.DistrictId;
                var result    = _service.GetSubstituteAvailability(model).ToList();
                var resources = result.Select(a => new CalendarResource
                {
                    id            = a.UserId,
                    title         = a.FirstName + " " + a.LastName,
                    profilePicUrl = a.ProfilePicUrl
                }).Distinct().ToList();
                var events = result.Select(a => new CalendarEvent
                {
                    id            = a.AvailabilityId,
                    title         = a.AvailabilityStatusTitle,
                    description   = "",
                    start         = DateTime.Parse(Convert.ToDateTime(a.StartDate).ToShortDateString() + " " + Convert.ToDateTime(a.StartTime).ToLongTimeString()).ToString("s"),
                    end           = DateTime.Parse(Convert.ToDateTime(a.StartDate).ToShortDateString() + " " + Convert.ToDateTime(a.StartTime).ToLongTimeString()).ToString("s"),
                    resourceId    = a.UserId,
                    resourceName  = a.FirstName + " " + a.LastName,
                    profilePicUrl = a.ProfilePicUrl,
                    Resources     = resources
                }).ToList();
                return(Ok(events));
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }
            return(null);
        }
Exemple #3
0
 public IEnumerable <SubstituteAvailability> GetSubstituteAvailability(SubstituteAvailability model)
 {
     return(_repo.GetSubstituteAvailability(model));
 }