/// <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(); }
/// <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(); }
/// <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(); }
/// <summary> ///To get one WebShop from DB /// </summary> public WebShopDTO GetById(int id) { WebShop webShop = uOW.WebShopRepo.GetByID(id); return(webShop != null?Mapper.Map <WebShopDTO>(webShop) : null); }