Ejemplo n.º 1
0
        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;
            }  
        }
Ejemplo n.º 2
0
 public Task UpdateTopic(int id, TopicModel topic)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 3
0
 public async Task<bool> AddTopic(int chapterId, TopicModel topic)
 {
     var path = ConfigManager.ServiceUrl + "/chapters/" + chapterId + ServicePath;
     return await HttpHelper.PostEntity(topic, path);
 }