예제 #1
0
        public ActionResult <int> PutTagById([FromBody] TagInputModel tagModel)
        {
            Mapper           mapper = new Mapper();
            TagDTO           tagDto = mapper.ConvertTagInputModelToTagDTO(tagModel);
            AuthorDataAccess tags   = new AuthorDataAccess();
            var tag = tags.GetTagById(tagModel.ID);

            if (tag == null)
            {
                return(BadRequest("Тега не существует"));
            }
            if (string.IsNullOrWhiteSpace(tagModel.Name))
            {
                return(BadRequest("Введите название тега"));
            }
            tags.UpdateTagById(tagDto);
            return(Ok(tagModel.ID));
        }