public async Task<int> AddModule(int courseId, ModuleModel moduleModel) { using (var dbContext = new EduTestEntities()) { var module = new Module() { Name = moduleModel.Name, CourseId = courseId }; dbContext.Modules.Add(module); if (await dbContext.SaveChangesAsync() == 0) throw new Exception("UserRepository.AddUser: Could not add user to db"); return module.Id; } }
public Task UpdateModule(int id, ModuleModel moduleModel) { throw new NotImplementedException(); }
public async Task<bool> AddModule(int courseId, ModuleModel module) { var path = ConfigManager.ServiceUrl + "/courses/" + courseId + ServicePath; return await HttpHelper.PostEntity(module, path); }