public void Install() { var pmsSummary = new PmsSummary(); pmsSummary.CreatedBy = _dataContext.Users.Local.First(x => x.Id == 1); pmsSummary.Id = 1; pmsSummary.IsActive = true; pmsSummary.Year = 2015; var listScoreIndicator = new Collection <ScoreIndicator> { new ScoreIndicator { Color = "red", Expression = "0 < x && x < 50" }, new ScoreIndicator { Color = "yellow", Expression = "50 <= x && x < 80" }, new ScoreIndicator { Color = "green", Expression = "80 <= x && x < 100" } }; pmsSummary.ScoreIndicators = listScoreIndicator; pmsSummary.Title = "1st Operation Year"; pmsSummary.CreatedDate = DateTime.Now; pmsSummary.UpdatedDate = DateTime.Now; _dataContext.PmsSummaries.AddOrUpdate(pmsSummary); }
public void Install() { var pmsSummary = new PmsSummary(); pmsSummary.CreatedBy = _dataContext.Users.Local.First(x => x.Id == 1); pmsSummary.Id = 1; pmsSummary.IsActive = true; pmsSummary.Year = 2015; var listScoreIndicator = new Collection<ScoreIndicator> { new ScoreIndicator {Color = "red", Expression = "0 < x && x < 50"}, new ScoreIndicator {Color = "yellow", Expression = "50 <= x && x < 80"}, new ScoreIndicator {Color = "green", Expression = "80 <= x && x < 100"} }; pmsSummary.ScoreIndicators = listScoreIndicator; pmsSummary.Title = "1st Operation Year"; pmsSummary.CreatedDate = DateTime.Now; pmsSummary.UpdatedDate = DateTime.Now; _dataContext.PmsSummaries.AddOrUpdate(pmsSummary); }
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); }
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; }