public async Task <IActionResult> ProductUpdate(CustomerGroupProductModel model) { var crp = await _customerGroupProductService.GetCustomerGroupProductById(model.Id); if (crp == null) { throw new ArgumentException("No customer group product found with the specified id"); } if (ModelState.IsValid) { crp.DisplayOrder = model.DisplayOrder; await _customerGroupProductService.UpdateCustomerGroupProduct(crp); return(new JsonResult("")); } return(ErrorForKendoGridJson(ModelState)); }
public virtual async Task <IList <CustomerGroupProductModel> > PrepareCustomerGroupProductModel(string customerGroupId) { var products = await _customerGroupProductService.GetCustomerGroupProducts(customerGroupId); var model = new List <CustomerGroupProductModel>(); foreach (var item in products) { var cr = new CustomerGroupProductModel { Id = item.Id, Name = (await _productService.GetProductById(item.ProductId))?.Name, ProductId = item.ProductId, DisplayOrder = item.DisplayOrder }; model.Add(cr); } return(model); }