public int DeleteDay(Day date) { Day dbEntry = context.Days.Find(date.d_ID); context.Days.Remove(dbEntry); context.SaveChanges(); return 0; }
public int SaveDay(Day date) { if (date.d_ID == 0) { List<Day> listDay = context.Days .Where(d => d.d_Date == date.d_Date) .ToList(); if (listDay.Count == 0) { context.Days.Add(date); context.SaveChanges(); } return date.d_ID; } else { return date.d_ID; } }