Esempio n. 1
0
        public void ChangeHistoryEndDate(int id, DateTimeOffset end)
        {
            ParticipationHistory history = db.ParticipationHistories.Find(id);

            if (history == null)
            {
                throw new NotFoundException();
            }
            history.EndDate = end;
        }
Esempio n. 2
0
        public void ChangeHistoryStartDate(int id, DateTimeOffset start)
        {
            ParticipationHistory history = db.ParticipationHistories.Find(id);

            if (history == null)
            {
                throw new NotFoundException();
            }
            history.StartDate = start;
        }
Esempio n. 3
0
        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));
        }
Esempio n. 5
0
 public void UpdateHistory(ParticipationHistory participationHistory)
 {
     db.Entry(participationHistory).State = EntityState.Modified;
 }
Esempio n. 6
0
        public ParticipationHistory CreateHistory(ParticipationHistory participationHistory)
        {
            var hist = db.ParticipationHistories.Add(participationHistory);

            return(hist);
        }