コード例 #1
0
        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;
            }   
        }
コード例 #2
0
 public async Task<bool> AddChapter(int moduleId, ChapterModel chapter)
 {
     var path = ConfigManager.ServiceUrl + "/modules/" + moduleId + ServicePath;
     return await HttpHelper.PostEntity(chapter, path);
 }
コード例 #3
0
 public Task UpdateChapter(int id, ChapterModel chapter)
 {
     throw new NotImplementedException();
 }