public async Task UpdateProject(Project model) { try { Db.Set <Project>().Update(model); await Db.SaveChangesAsync(); } catch (Exception ex) { throw new Exception("Error: ", ex); } }
public async Task <bool> UpdateProject(Project project) { var currentProject = await this.FindProjectById(project.Id); if (currentProject == null) { return(false); } _context.Entry(currentProject).CurrentValues.SetValues(project); return(await _context.SaveChangesAsync() > 0); }
public async Task CreateCourse(Course model) { try { await Db.Set <Course>().AddAsync(model); await Db.SaveChangesAsync(); } catch (Exception ex) { throw new Exception("Error: ", ex); } }