public bool Delete(int id) { ScheduledFrequency dbEntity = objDataContext.ScheduledFrequencies.Where(x => x.ScheduledFrequencyId == id).Select(x => x).SingleOrDefault(); objDataContext.ScheduledFrequencies.Remove(dbEntity); objDataContext.SaveChanges(); return(true); }
public int Save(ScheduledFrequency dao) { ScheduledFrequency entity = objDataContext.ScheduledFrequencies.SingleOrDefault(x => x.ScheduledFrequencyId.Equals(dao.ScheduledFrequencyId)); if (entity != null) { dao.ModifiedAt = DateTimeOffset.Now; objDataContext.Entry(entity).CurrentValues.SetValues(dao); } else { dao.CreatedAt = DateTimeOffset.Now; dao.ModifiedAt = dao.CreatedAt; objDataContext.ScheduledFrequencies.Add(dao); } objDataContext.SaveChanges(); return(dao.ScheduledFrequencyId); }