示例#1
0
        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);
            }
        }
示例#2
0
 public DashboardPresetService(DashboardDBEntities2 context)
 {
     _context = context;
 }