public void DeleteHoliday(int Id) { var deletediz = new OPTHolidayModel(); deletediz.Id = Id; this.context.Remove(deletediz); this.context.SaveChanges(); }
public async Task <List <HolidayModel> > UpdateRefHolidayTable() { var holidays3party = await this.holidayService.GetHolidaysList(); var index = 1; this.context.Database.ExecuteSqlCommand("TRUNCATE TABLE holiday"); foreach (var holiday in holidays3party) { OPTHolidayModel model = new OPTHolidayModel(); model.Id = index; model.Date = holiday.Date; model.Title = holiday.Title; model.Description = holiday.Description; model.Legislation = holiday.Legislation; model.Type = holiday.Type; model.VariableDates = holiday.VariableDates; this.context.Add(model); index++; } this.context.SaveChanges(); return(holidays3party); }
public void UpdateHoliday(int Id, [FromBody] OPTHolidayModel model) { this.context.Update(model); this.context.SaveChanges(); }