public async Task<int> AddTopic(int chapterId, TopicModel topicModel) { using (var dbContext = new EduTestEntities()) { var topic = new Topic() { Name = topicModel.Name, ChapterId = chapterId }; dbContext.Topics.Add(topic); if (await dbContext.SaveChangesAsync() == 0) throw new Exception("TopicRepository.AddTopic: Could not add topic to db"); return topic.Id; } }
public Task UpdateTopic(int id, TopicModel topic) { throw new NotImplementedException(); }
public async Task<bool> AddTopic(int chapterId, TopicModel topic) { var path = ConfigManager.ServiceUrl + "/chapters/" + chapterId + ServicePath; return await HttpHelper.PostEntity(topic, path); }