예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            WebShopDTO wShop = WebShopManager.GetById(id);

            WebShopManager.Delete(wShop);
            return(RedirectToAction("Index"));
        }
예제 #2
0
        /// <summary>
        ///To insert WebShop into the DB
        /// </summary>
        public void Insert(WebShopDTO webShop)
        {
            if (webShop == null)
            {
                return;
            }
            WebShop wShop = Mapper.Map <WebShop>(webShop);

            wShop.Status = true;
            uOW.WebShopRepo.Insert(wShop);
            uOW.Save();
        }
예제 #3
0
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(HttpNotFound());
            }
            WebShopDTO webShop = WebShopManager.GetById((int)id);

            if (webShop != null)
            {
                return(PartialView(webShop));
            }
            return(HttpNotFound());
        }
예제 #4
0
        /// <summary>
        /// To delete one WebShop in the DB
        /// </summary>
        public void Delete(WebShopDTO webShop)
        {
            if (webShop == null)
            {
                return;
            }
            WebShop wShop = uOW.WebShopRepo.GetByID(webShop.Id);

            if (wShop == null)
            {
                return;
            }
            wShop.Status = false;
            uOW.Save();
        }
예제 #5
0
 public ActionResult Create(WebShopDTO webShop, HttpPostedFileBase upload)
 {
     if (!ModelState.IsValid)
     {
         return(View(webShop));
     }
     if (upload != null)
     {
         webShop.LogoPath = CreateImgName();
         var path = Path.Combine("~", GetLogoDirectory(), webShop.LogoPath);
         upload.SaveAs(Server.MapPath(path));
     }
     WebShopManager.Insert(webShop);
     return(RedirectToAction("Index"));
 }
예제 #6
0
        public ActionResult Edit(short?id)
        {
            if (id == null)
            {
                return(HttpNotFound());
            }

            WebShopDTO webShop = WebShopManager.GetById((int)id);

            if (webShop == null)
            {
                return(HttpNotFound());
            }

            return(View(webShop));
        }
예제 #7
0
        /// <summary>
        /// To update one WebShop in the DB
        /// </summary>
        public void Update(WebShopDTO webShop)
        {
            if (webShop == null)
            {
                return;
            }
            WebShop wShop = uOW.WebShopRepo.GetByID(webShop.Id);

            if (wShop == null)
            {
                return;
            }

            wShop.Name = webShop.Name;
            //if LogoPath null it may be lead to data loss
            wShop.LogoPath = webShop.LogoPath ?? wShop.LogoPath;
            wShop.Path     = webShop.Path;
            uOW.Save();
        }