Пример #1
0
        public async Task <ActionResult <IEnumerable <NewsOutputModel> > > GetAllNews()
        {
            var news = NewsMapper.ToOutputModels(await newsStorage.NewsGetAll());

            if (news == null)
            {
                return(NotFound("Objects not fount"));
            }

            return(Ok(news));
        }
Пример #2
0
        [HttpGet("for-user/{userId}")]  //1220
        public async Task <ActionResult <IEnumerable <NewsOutputModel> > > GetAllNewsForUser(int userId)
        {
            var news = NewsMapper.ToOutputModels(await newsStorage.NewsGetAllByUserRegistrationDate(userId));

            if (news == null)
            {
                return(NotFound("Objects not fount"));
            }

            return(Ok(news));
        }
Пример #3
0
        public async Task <ActionResult <IEnumerable <NewsOutputModel> > > GetNewsByTeacherId(int id)
        {
            if (id.Equals(null))
            {
                return(BadRequest("Id is empty"));
            }

            var news = NewsMapper.ToOutputModels(await newsStorage.GetNewsForTeacherFromHR(id));

            if (news == null)
            {
                return(NotFound("Object not found"));
            }
            return(Ok(news));
        }