public Task Send(NewsItem item) { if (!_repository.GroupExists(item.NewsGroup)) { throw new Exception("Cannot send to a news group that doesn't exist."); } _repository.AddNewsItem(item); return(Clients.Group(item.NewsGroup).SendAsync("Send", item)); }
public NewsItem addNewsItem([FromBody] NewsItem newsItem) { newsRepository.AddNewsItem(newsItem); return(newsItem); }