Exemplo n.º 1
0
 public ActionResult Edit(tbl_SystemContent content)
 {
     if (ModelState.IsValid)
     {
         db.Entry(content).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(content));
 }
Exemplo n.º 2
0
        public ActionResult AddBanner()
        {
            tbl_SystemContent tbl_SystemContent = db.tbl_SystemContent.Find(laca.Models.SytemContent.Banner);

            if (tbl_SystemContent == null)
            {
                return(HttpNotFound());
            }
            return(View(tbl_SystemContent));
        }
Exemplo n.º 3
0
        public ActionResult Edit(laca.Models.SytemContent id = 0)
        {
            tbl_SystemContent tbl_SystemContent = db.tbl_SystemContent.Find(id);

            if (tbl_SystemContent == null)
            {
                return(HttpNotFound());
            }
            return(View(tbl_SystemContent));
        }
Exemplo n.º 4
0
        public ActionResult AddBanner(tbl_SystemContent content, HttpPostedFileBase file)
        {
            content.PropertyContent = file.FileName;
            if (ModelState.IsValid)
            {
                if (file != null)
                {
                    char   DirSeparator = System.IO.Path.DirectorySeparatorChar;
                    string FilesPath    = "~\\Images";
                    string full_path    = Server.MapPath(FilesPath).Replace("SystemContent", "").Replace("AddBanner", "");
                    if (content.PropertyContent + "" != "")
                    {
                        FileUpload.DeleteFile(content.PropertyContent, full_path);
                    }

                    content.PropertyContent = FileUpload.UploadFile(file, full_path);
                }
                db.Entry(content).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(content));
        }