예제 #1
0
        public ActionResult AddClass(opr.Models.ClassesTable model)
        {
            oprEntities db = new oprEntities();


            db.ClassesTables.Add(model);

            db.SaveChanges();
            return(View());
        }
예제 #2
0
        public ActionResult EditClass(opr.Models.ClassesTable model)
        {
            oprEntities cls = new oprEntities();

            model.IsDeleted        = true;
            model.IsActive         = true;
            cls.Entry(model).State = System.Data.Entity.EntityState.Modified;
            try
            {
                cls.SaveChanges();
                return(RedirectToAction("Index"));
            }
            catch
            {
            }
            ModelState.AddModelError("", "Unable to save changes");
            return(View(model));
        }