public ActionResult DeleteConfirmed(int id) { WebShopDTO wShop = WebShopManager.GetById(id); WebShopManager.Delete(wShop); return(RedirectToAction("Index")); }
/// <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(); }
public ActionResult Delete(int?id) { if (id == null) { return(HttpNotFound()); } WebShopDTO webShop = WebShopManager.GetById((int)id); if (webShop != null) { return(PartialView(webShop)); } return(HttpNotFound()); }
/// <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(); }
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")); }
public ActionResult Edit(short?id) { if (id == null) { return(HttpNotFound()); } WebShopDTO webShop = WebShopManager.GetById((int)id); if (webShop == null) { return(HttpNotFound()); } return(View(webShop)); }
/// <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(); }