Exemple #1
0
 public static ReportRating FromInputModel(ReportRatingInputModel currentRaiting)
 {
     if (currentRaiting.EndDate != null && currentRaiting.StartDate != null)
     {
         return(new ReportRating
         {
             StartDate = DateTime.Parse(currentRaiting.StartDate),
             EndDate = DateTime.Parse(currentRaiting.EndDate)
         });
     }
     return(null);
 }
Exemple #2
0
        public async Task <ActionResult <List <ReportRatingOutputModel> > > GetAverageRatingByDate([FromBody] ReportRatingInputModel ratings)
        {
            if (ratings == null)
            {
                return(BadRequest("Model is empty"));
            }
            var averageRating = ReportRatingMapper.ToOutputModels(await reportStorage.GetAverageRating(ReportRatingMapper.FromInputModel(ratings)));

            if (averageRating.Equals(null))
            {
                return(NotFound("Object not found"));
            }
            return(Ok(averageRating));
        }