Example #1
0
 public static Domain.Models.Website GetWebsite(int id)
 {
     using (var db = new AppContext())
     {
         return db.Websites.Find(id);
     }
 }
 public Template Get(string templateName)
 {
     using (var db = new AppContext())
     {
         return db.Templates.FirstOrDefault(t => t.Name == templateName);
     }
 }
Example #3
0
 static Helpers()
 {
     using (var context = new AppContext())
     {
         m2 = context.Movements.ToList();
     }
     using (var db = new ACDBContext())
     {
         m1 = db.MovementClasses.ToList();
     }
 }
        public bool Update(Template template)
        {
            bool ret = false;

            ret = Validate(template);

            if (ret)
            {
                // TODO: Create UPDATE code here
                using (var db = new AppContext())
                {
                    db.Templates.AddOrUpdate(template);
                    db.SaveChanges();
                }
            }

            return ret;
        }
 public ApiBaseController()
 {
     db = new AppContext();
 }