예제 #1
0
        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);
            }
        }
예제 #2
0
        // 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);
            }
        }
예제 #3
0
        // 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);
            }
        }
예제 #4
0
        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);
 }