Exemplo n.º 1
0
        public ActionResult AddCampus(Campus_Table tabl)
        {
            oprEntities camdb = new oprEntities();

            camdb.Campus_Table.Add(tabl);
            camdb.SaveChanges();

            return(View());
        }
Exemplo n.º 2
0
        public ActionResult DeleteCampus(int Id)
        {
            oprEntities  camdb     = new oprEntities();
            Campus_Table deletecam = camdb.Campus_Table.Find(Id);

            camdb.Campus_Table.Remove(deletecam);
            camdb.SaveChanges();

            return(RedirectToAction("Index"));
        }
Exemplo n.º 3
0
        public ActionResult EditCampus(int Id)
        {
            ViewBag.userName = User.Identity.Name;
            ViewBag.idcam    = User.Identity.GetUserId();
            ViewBag.date     = DateTime.Now;

            oprEntities  camdb   = new oprEntities();
            Campus_Table camdata = camdb.Campus_Table.Find(Id);

            return(View(camdata));
        }
Exemplo n.º 4
0
        public ActionResult EditCampus(Campus_Table camtbl)
        {
            oprEntities camdb = new oprEntities();


            camdb.Entry(camtbl).State = EntityState.Modified;

            try
            {
                camdb.SaveChanges();
                return(RedirectToAction("Index"));
            }
            catch
            {
            }
            ModelState.AddModelError("", "Unable to Save Changes made to the Entity :(");

            return(View(camtbl));
        }