public static Holiday UpdateHoliday(Holiday holiday) { using (var entity = new StaffingModelContainer()) { entity.VacanceTable.Single(o => o.ID == holiday.Id).Update(holiday); entity.SaveChanges(); holiday = entity.VacanceTable.Single(o => o.ID == holiday.Id).CreateHoliday(); } switch (holiday.Status) { case ItemStatus.Waiting: Mail.Send(holiday.ConsultantId, MailType.HolidayRequest, holiday); break; case ItemStatus.Refused: Mail.Send(holiday.ConsultantId, MailType.HolidayRefused, holiday); break; case ItemStatus.Validate: Mail.Send(holiday.ConsultantId, MailType.HolidayValidated, holiday); break; } return holiday; }
public static void DeleteHoliday(Holiday holiday) { using (var entity = new StaffingModelContainer()) { entity.VacanceTable.Single(o => o.ID == holiday.Id).Actif = false; entity.SaveChanges(); } }
internal static Holiday AddHoliday(Holiday newHoliday) { using (var entity = new StaffingModelContainer()) { var result = entity.VacanceTable.Add(newHoliday.CreateDatabaseHoliday()); entity.SaveChanges(); return result.CreateHoliday(); } }
public void DeleteHoliday(Holiday holiday, string token) { if (!IsConnected(token)) { throw new NotConnectedException(); } HolidayDAL.DeleteHoliday(holiday); }
public Holiday UpdateHoliday(Holiday holiday, string token) { if (!IsConnected(token)) { throw new NotConnectedException(); } return HolidayDAL.UpdateHoliday(holiday); }