示例#1
0
        public async Task <IActionResult> UpdateRss(int id, FeedRssEditDto dto)
        {
            // if (id != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value))
            //     return Unauthorized();

            var rssFromRepo = await _repo.GetFeedRss(id);

            _mapper.Map(dto, rssFromRepo);

            var webClient = new WebClient();

            rssFromRepo.Icon = webClient.DownloadData(dto.NewIconPath);

            if (await _repo.SaveAll())
            {
                return(NoContent());
            }

            throw new Exception($"Updating category {id} failed to save");
        }