Exemplo n.º 1
0
        public ActionResult PostFeature(FEATURE fEATURE, HttpPostedFileBase file)
        {
            CMSAPPEntities db      = new CMSAPPEntities();
            var            model   = db.FEATURES.Where(x => x.ID.Equals(fEATURE.ID)).FirstOrDefault();
            string         dstring = "";

            dstring = DateTime.Now.ToLongDateString();

            if (file != null && file.ContentLength > 0)
            {
                string fileName = Path.GetFileName(file.FileName);
                string imgpath  = Path.Combine(Server.MapPath("~/images/"), dstring + fileName);
                file.SaveAs(imgpath);
                fEATURE.FEATURE_PATH = "~/images/" + dstring + file.FileName;
            }

            if (model != null)
            {
                model.FEATURE_NAME = fEATURE.FEATURE_NAME;
                model.SEQ          = fEATURE.SEQ;
            }
            else
            {
                db.FEATURES.Add(fEATURE);
            }
            db.SaveChanges();
            return(RedirectToAction("FeatureList"));
        }
Exemplo n.º 2
0
 public ActionResult FeatureDelete(int id)
 {
     try
     {
         using (CMSAPPEntities db = new CMSAPPEntities())
         {
             FEATURE item = db.FEATURES.Where(x => x.ID == id).FirstOrDefault();
             db.FEATURES.Remove(item);
             db.SaveChanges();
             return(RedirectToAction("FeatureList"));
         }
     }
     catch (Exception ex)
     {
         return(RedirectToAction("FeatureList"));
     }
 }
Exemplo n.º 3
0
 public ActionResult MenuDelete(int id)
 {
     try
     {
         using (CMSAPPEntities db = new CMSAPPEntities())
         {
             MENU item = db.MENUs.Where(x => x.ID == id).FirstOrDefault();
             db.MENUs.Remove(item);
             db.SaveChanges();
             return(RedirectToAction("MenuList"));
         }
     }
     catch (Exception ex)
     {
         return(RedirectToAction("MenuList"));
     }
 }
Exemplo n.º 4
0
        public ActionResult PostMenu(MENU menu)
        {
            CMSAPPEntities db    = new CMSAPPEntities();
            var            model = db.MENUs.Where(x => x.ID.Equals(menu.ID)).FirstOrDefault();

            if (model != null)
            {
                model.MENU_NAME    = menu.MENU_NAME;
                model.MENU_ADDRESS = menu.MENU_ADDRESS;
                model.SEQ          = menu.SEQ;
            }
            else
            {
                db.MENUs.Add(menu);
            }
            db.SaveChanges();
            return(RedirectToAction("MenuList"));
        }