public void ChangeHistoryEndDate(int id, DateTimeOffset end) { ParticipationHistory history = db.ParticipationHistories.Find(id); if (history == null) { throw new NotFoundException(); } history.EndDate = end; }
public void ChangeHistoryStartDate(int id, DateTimeOffset start) { ParticipationHistory history = db.ParticipationHistories.Find(id); if (history == null) { throw new NotFoundException(); } history.StartDate = start; }
public void DeleteHistory(int id) { ParticipationHistory participation = db.ParticipationHistories.Find(id); if (participation == null) { throw new NotFoundException(); } db.ParticipationHistories.Remove(participation); }
public ParticipationHistoryDTO CreateHistory(ParticipationHistoryDTO historyDTO) { ProjectWork work = Database.ProjectWorks.GetProjectWorkById(historyDTO.ProjectWorkId); if (historyDTO.StartDate > historyDTO.EndDate) { throw new InvalidDateException(); } ParticipationHistory history = new ParticipationHistory { ProjectWorkId = historyDTO.ProjectWorkId, ProjectWork = work, StartDate = historyDTO.StartDate, EndDate = historyDTO.EndDate }; var hist = Database.ParticipationHistories.CreateHistory(history); Database.Save(); return(Map.ObjectMap(hist)); }
public void UpdateHistory(ParticipationHistory participationHistory) { db.Entry(participationHistory).State = EntityState.Modified; }
public ParticipationHistory CreateHistory(ParticipationHistory participationHistory) { var hist = db.ParticipationHistories.Add(participationHistory); return(hist); }