public WebsiteTemplateProject.Models.Dashboard UpsertDashboardPresets(WebsiteTemplateProject.Models.Dashboard dashboard, DashboardDBEntities2 db) { using (db) { if (dashboard.presetId == default(int)) { db.Dashboards.Add(dashboard); } else { db.Entry(dashboard).State = EntityState.Modified; } try { db.SaveChanges(); } catch (DbEntityValidationException e) { var newException = new FormattedDbEntityValidationException(e); throw newException; } return(dashboard); } }
public DashboardPresetService(DashboardDBEntities2 context) { _context = context; }