public CRM_KA_ProductModel getProductById(Guid id) { objKAProduct = new CRM_KA_ProductRepository(); Mapper.CreateMap<CRM_KA_Product, CRM_KA_ProductModel>(); var entity = objKAProduct.GetSingle(x => x.id.Equals(id)); CRM_KA_ProductModel result = new CRM_KA_ProductModel(); result = Mapper.Map(entity, result); return result; }
public void saveProduct(CRM_KA_ProductModel entity) { objKAProduct = new CRM_KA_ProductRepository(); CRM_KA_Product Product = new CRM_KA_Product(); Product.id = entity.id; Product.CustomerID = entity.CustomerID; Product.Product = entity.Product; objKAProduct.Add(Product); }
public ActionResult AddProduct(CRM_KA_ProductModel ProductModel, string CustomerID) { try { if (ModelState.IsValid) { ProductModel.id = System.Guid.NewGuid(); ProductModel.CustomerID = CustomerID; _KeyAccountManager.saveProduct(ProductModel); updateKeyAccount(CustomerID); ViewData["CustomerID"] = CustomerID; return PartialView("_KA_ProductList"); } else { throw new Exception(); } } catch (Exception ex) { var modal = new HandleErrorInfo(ex, "KeyAccount", "Index"); return View("Error", modal); } }