Esempio n. 1
0
        public ActionResult EditItem(Item p)
        {
            if (p.upload != null)
            {
                string filename = System.IO.Path.GetFileName(p.upload.FileName);
                p.upload.SaveAs(Server.MapPath("~/Assets/img/bg-img/" + filename));
                p.photo = "/Assets/img/bg-img/" + filename;
            }


            if (ModelState.IsValid)
            {
                ItemBL itemBL = new ItemBL();
                itemBL.EditItem(p);
                return(RedirectToAction("Shop", "Home"));
            }
            return(View(p));
        }
Esempio n. 2
0
 public void SaveItem([FromForm] ItemModel itemModel, int mode)
 {
     try
     {
         var itemBL = new ItemBL();
         if (mode == 1)
         {
             itemBL.SaveItem(itemModel, _hostingEnvironment);
         }
         else
         {
             itemBL.EditItem(itemModel, _hostingEnvironment);
         }
     }
     catch (Exception)
     {
     }
 }