Пример #1
0
        public ActionResult ModelSpecs(ProductModelViewModel viewModel)
        {
            try
            {
                ProductModelResponse contactResp = new ProductModelResponse();

                contactResp.ProductModel = viewModel.ProductModel.MapClientToServer();
                if (viewModel.TechnicalSpecs != null)
                {
                    contactResp.ProductModelTechnicalSpec = viewModel.ProductTechnicalSpec.Select(x => x.MapClientToServer()).ToList();
                }

                productModelService.SaveProductModel(contactResp);
                TempData["message"] = new MessageViewModel
                {
                    IsSaved = true,
                    Message = "Your data has been saved successfully!"
                };
                if (string.IsNullOrEmpty(Request.QueryString["returnUrl"]))
                {
                    return(RedirectToAction("ModelSpecs", new { product = viewModel.ProductModel.ProductId }));
                }
                return(Redirect(Request.QueryString["returnUrl"]));
            }
            catch (Exception ex)
            {
                return(View(viewModel));
            }
        }