public static SemesterUpdateableModel MapSemesterUpdateableModel(SemesterUpdate source) { return(new SemesterUpdateableModel { EndDate = source.EndDate, Id = source.Id, StartDate = source.StartDate }); }
public async Task Delete(SemesterUpdate semester) { ValidationErrors = null; try { await _semesterService.Delete(semester.Id); Semesters.RowEditOptions.EditRowId = null; Semesters.RequestRefresh(); } catch (ValidationException ve) { ValidationErrors = ve.Errors; } }
// Update specific item public SemesterUpdate UpdateSemester(SemesterUpdate updatedSemester) { var p = ds.Semesters.Find(updatedSemester.Id); if (p == null) { return(null); } else { // For the object fetched from the data store, // set its values to those provided // (the method ignores missing properties, and navigation properties) ds.Entry(p).CurrentValues.SetValues(updatedSemester); ds.SaveChanges(); return(updatedSemester); } }
public async Task SaveEdit(SemesterUpdate semester) { ValidationErrors = null; try { await _semesterService.UpdateBasic(semester.Id, semester); Semesters.RowEditOptions.EditRowId = null; Semesters.RequestRefresh(); } catch (ValidationPropertyException vpe) { ValidationErrors = vpe.ErrorsList; } catch (ValidationException ve) { ValidationErrors = ve.Errors; } }
public async Task<SemesterUpdate> UpdateBasic(int semesterId, SemesterUpdate model) { var semester = await context.Semester.FirstOrDefaultAsync(_ => _.Id == semesterId); if (semester == null) throw new ValidationException("Requested semester doesn't exist."); UpdateValues(semester, model); Validate(semester); await context.SaveChangesAsync(); return new SemesterUpdate { Id = semester.Id, StartDate = semester.StartDate, EndDate = semester.EndDate, IsWinter = semester.IsWinter } ; }
public void Edit(SemesterUpdate semester) { Semesters.RowEditOptions.EditRowId = semester.Id; }
public void UpdateSemester(SemesterUpdate semester) { _utilityService.GetSemesterUpdates(semester); }
public static SemesterUpdateableModel MapSemesterUpdateableModel(this SemesterUpdateableModel dest, SemesterUpdate source) { dest.EndDate = source.EndDate; dest.Id = source.Id; dest.StartDate = source.StartDate; return(dest); }