public async Task<int> AddChapter(int moduleId, ChapterModel chapterModel) { using (var dbContext = new EduTestEntities()) { var chapter = new Chapter() { Name = chapterModel.Name, ModuleId = moduleId }; dbContext.Chapters.Add(chapter); if (await dbContext.SaveChangesAsync() == 0) throw new Exception("ChapterRepository.AddChapter: Could not add user to db"); return chapter.Id; } }
public async Task<bool> AddChapter(int moduleId, ChapterModel chapter) { var path = ConfigManager.ServiceUrl + "/modules/" + moduleId + ServicePath; return await HttpHelper.PostEntity(chapter, path); }
public Task UpdateChapter(int id, ChapterModel chapter) { throw new NotImplementedException(); }