/// <summary> /// Updates news item by id /// </summary> /// <param name="newsItem">new information on news item to switch to</param> /// <param name="id">id of news item to update</param> public void UpdateNewsItemById(NewsItemInputModel newsItem, int id) { var oldNewsItem = _newsItemRepository.GetNewsItemById(id); if (oldNewsItem == null) { throw new ResourceNotFoundException($"News item with id {id} was not found."); } _newsItemRepository.UpdateNewsItemById(newsItem, id); }
public void UpdateNewsItemById(NewsItemInputModel newsItem, int newsItemId) { var validNewsItem = _repo.GetNewsItemById(newsItemId); if (validNewsItem == null) { throw new ResourceNotFoundException($"News item with id {newsItemId} was not found."); } _repo.UpdateNewsItemById(newsItem, newsItemId); }