public bool DeleteAppointmentByID(Guid id) { var appointmentToBeDeleted = _context.Appointments.First(a => a.AppointmentID == id); if (appointmentToBeDeleted != null) { var response = _context.Remove(appointmentToBeDeleted); _context.SaveChanges(); return(true); } else { return(false); } }
// Delete metric based on ID public bool DeleteMetricByID(Guid id) { var metricToBeDeleted = _context.Metrics.First(m => m.MetricID == id); if (metricToBeDeleted != null) { var response = _context.Remove(metricToBeDeleted); _context.SaveChanges(); return(true); } else { return(false); } }
// Delete fiscal year based on ID public bool DeleteFiscalYearByID(Guid id) { var fiscalYearToBeDeleted = _context.FiscalYears.SingleOrDefault(fy => fy.FiscalYearID.Equals(id)); if (fiscalYearToBeDeleted != null) { var response = _context.Remove(fiscalYearToBeDeleted); _context.SaveChanges(); return(true); } else { return(false); } }
public bool DeleteList(DeleteListDto deleteListDto) { if (!_context.Boards.Any(x => x.Id == deleteListDto.BoardId)) { return(false); } var list = _context.Lists.SingleOrDefault(l => l.Id == deleteListDto.ListId); if (list == null) { return(false); } _context.Remove(list); var result = _context.SaveChanges(); return(result > 0); }
public void Delete <T>(T entity) where T : class { _context.Remove(entity); }