コード例 #1
0
        public DeletePmsResponse DeletePmsConfigDetails(int id)
        {
            var response = new DeletePmsResponse();

            try
            {
                var pmsConfigDetails = DataContext.PmsConfigDetails
                                       .Include(x => x.ScoreIndicators)
                                       .Single(x => x.Id == id);
                foreach (var scoreIndicator in pmsConfigDetails.ScoreIndicators.ToList())
                {
                    DataContext.ScoreIndicators.Remove(scoreIndicator);
                }
                DataContext.PmsConfigDetails.Remove(pmsConfigDetails);
                DataContext.SaveChanges();
                response.IsSuccess = true;
                response.Message   = "Pms Config Detail item has been deleted successfully";
            }
            catch (DbUpdateException dbUpdateException)
            {
                response.Message = dbUpdateException.Message;
            }

            return(response);
        }
コード例 #2
0
        public DeletePmsResponse DeletePmsSummary(int id)
        {
            var response = new DeletePmsResponse();

            try
            {
                var pmsSummary = new PmsSummary {
                    Id = id
                };
                DataContext.PmsSummaries.Attach(pmsSummary);
                DataContext.Entry(pmsSummary).State = EntityState.Deleted;
                DataContext.SaveChanges();
                response.IsSuccess = true;
                response.Message   = "Pms Summary item has been deleted successfully";
            }
            catch (DbUpdateException dbUpdateException)
            {
                response.Message = dbUpdateException.Message;
            }

            return(response);
        }