Example #1
0
 public void EditVarient(ProductVarientViewModel model)
 {
     if (!ModelState.IsValid) {
         return;
     }
     var varient = ProductVarientModel.ToDomainModel(model.ProductVarient);
     if (varient.Id > 0) {
         masterService.UpdateProductVarient(varient);
     } else {
         masterService.AddProductVarient(new[] { varient });
     }
 }
Example #2
0
 public ActionResult EditVarient(int id)
 {
     var varient = id > 0
                     ? ProductVarientModel.FromDomainModel(masterService.GetProductVarient(id))
                     : new ProductVarientModel();
     var model = new ProductVarientViewModel {
         ProductVarient = varient,
         Products = masterService.GetAllProducts().Select(x => new KeyValuePair<int, string>(x.Id, x.Name)).ToList()
     };
     return PartialView("EditVarient", model);
 }