public ActionResult AddBrand(CRM_KA_BrandModel BrandModel, string CustomerID) { try { if (ModelState.IsValid) { BrandModel.id = System.Guid.NewGuid(); BrandModel.CustomerID = CustomerID; _KeyAccountManager.saveBrand(BrandModel); updateKeyAccount(CustomerID); ViewData["CustomerID"] = CustomerID; return PartialView("_KA_BrandList"); } else { throw new Exception(); } } catch (Exception ex) { var modal = new HandleErrorInfo(ex, "KeyAccount", "Index"); return View("Error", modal); } }
public void saveBrand(CRM_KA_BrandModel entity) { objKABrand = new CRM_KA_BrandRepository(); CRM_KA_Brand Brand = new CRM_KA_Brand(); Brand.id = entity.id; Brand.CustomerID = entity.CustomerID; Brand.Brand = entity.Brand; objKABrand.Add(Brand); }
public CRM_KA_BrandModel getBrandById(Guid id) { objKABrand = new CRM_KA_BrandRepository(); Mapper.CreateMap<CRM_KA_Brand, CRM_KA_BrandModel>(); var entity = objKABrand.GetSingle(x => x.id.Equals(id)); CRM_KA_BrandModel result = new CRM_KA_BrandModel(); result = Mapper.Map(entity, result); return result; }