Esempio n. 1
0
        public IHttpActionResult Get()
        {
            ICollection <ScheduleElementResponseModel> scheduleElements = new List <ScheduleElementResponseModel>();
            var competitionService = ServiceProvider.GetCompetitionService();

            try
            {
                var competitions = competitionService.GetActualCompetitions();
                foreach (var competition in competitions)
                {
                    scheduleElements.Add(ObjectMapperDTOModel.ToModel(competition));
                }
                return(Json(scheduleElements));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
Esempio n. 2
0
        public IHttpActionResult Receive([FromBody] UserIdRequestModel userId)
        {
            if (!ModelState.IsValid)
            {
                return(this.BadRequest(ModelState));
            }
            var systemService = ServiceProvider.GetSystemService();

            try
            {
                var notifications = systemService.GetNotificationByToAccountId(userId.id);
                ICollection <Models.ResponseModels.NotificationResponseModel> response = new List <Models.ResponseModels.NotificationResponseModel>();
                foreach (var notificationDTO in notifications)
                {
                    response.Add(ObjectMapperDTOModel.ToModel(notificationDTO));
                }
                return(Json(response));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }