public int UpdateNews(int id, UpdatedNewsDto updatedNewsDto) { var news = GetNewsEntity(id); news.Title = updatedNewsDto.Title ?? news.Title; news.Description = updatedNewsDto.Description ?? news.Description; news.UserId = updatedNewsDto.UserId ?? news.UserId; _db.News.Update(news); _db.SaveChanges(); return(news.Id); }
public ActionResult <IdDto> UpdateNews(int id, [FromBody] UpdatedNewsDto updatedNewsDto) { return(new OkObjectResult(new { Id = _newsService.UpdateNews(id, updatedNewsDto) })); }