Exemplo n.º 1
0
        // GET: MvcProductModels/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ProductModel productModel = db.ProductModels.Find(id);

            if (productModel == null)
            {
                return(HttpNotFound());
            }

            EditProductModel editedProduct = new EditProductModel
            {
                Id          = productModel.Id,
                Name        = productModel.Name,
                Description = productModel.Description,

                IsAvailable = productModel.IsAvailable,
                Price       = productModel.Price
            };

            ViewBag.CurrentImage = productModel.ImagePath;
            return(View(editedProduct));
        }
Exemplo n.º 2
0
        public IActionResult Edit(EditProductModel model)
        {
            int  productId;
            bool result = int.TryParse(model.ProductType, out productId);

            if (!result)
            {
                return(this.View());
            }

            Product product;

            using (this.Context)
            {
                product = this.Context
                          .Products
                          .Where(p => p.Id == model.Id)
                          .Select(a => a)
                          .FirstOrDefault();

                product.Name        = model.Name;
                product.Price       = model.Price;
                product.Description = model.Description;

                product.ProductType = this.Context
                                      .ProductTypes
                                      .Where(t => t.Id == productId)
                                      .Select(p => p)
                                      .FirstOrDefault();

                this.Context.Products.Update(product);
                this.Context.SaveChanges();
            }
            return(this.RedirectToHome());
        }
Exemplo n.º 3
0
        public ActionResult Edit(EditProductModel vm)
        {
            try
            {
                //Keep the list of DropDown
                vm.CategoryList = _categoryService.List().OrderBy(x => x.Name).ToList();

                //Check data validation
                if (!ModelState.IsValid)
                {
                    this.AddToastMessage(Messages.InvalidValueField, ToastType.Error);
                    return(View("Edit", vm));
                }

                //Update Product
                _productService.Update(vm);

                //Successfully message
                this.AddToastMessage(string.Format(Messages.RecordSavedSuccessfully, "product"), ToastType.Success);

                return(RedirectToAction("Index"));
            }
            catch (CustomException ex)
            {
                this.AddToastMessage(ex.Message, ToastType.Error);
                return(View("Edit", vm));
            }
            catch (Exception ex)
            {
                this.AddToastMessage(Messages.GeneralError, ToastType.Error);
                return(View("Edit", vm));
            }
        }
Exemplo n.º 4
0
        public ActionResult EditProduct(int pid = -1)
        {
            ProductInfo productInfo = AdminProducts.AdminGetProductById(pid);

            if (productInfo == null)
            {
                return(PromptView("商品不存在"));
            }

            CategoryInfo vCategoryInfo = AdminCategories.GetCategoryById(productInfo.CateId);
            string       vCateName     = "";

            if (vCategoryInfo != null)
            {
                vCateName = vCategoryInfo.Name;
            }


            EditProductModel model = new EditProductModel();

            model.PSN          = productInfo.PSN;
            model.CateId       = productInfo.CateId;
            model.CategoryName = vCateName;
            model.BrandId      = productInfo.BrandId;
            model.ProductName  = productInfo.Name;
            model.ShopPrice    = productInfo.ShopPrice;
            model.MarketPrice  = productInfo.MarketPrice;
            model.CostPrice    = productInfo.CostPrice;
            model.State        = productInfo.State;
            model.IsBest       = productInfo.IsBest == 1 ? true : false;
            model.IsHot        = productInfo.IsHot == 1 ? true : false;
            model.IsNew        = productInfo.IsNew == 1 ? true : false;
            model.DisplayOrder = productInfo.DisplayOrder;
            model.Weight       = productInfo.Weight;
            model.Description  = productInfo.Description;

            model.BrandName = AdminBrands.GetBrandById(productInfo.BrandId).Name;


            //库存信息
            ProductStockInfo productStockInfo = AdminProducts.GetProductStockByPid(pid);

            model.StockNumber = productStockInfo.Number;
            model.StockLimit  = productStockInfo.Limit;

            //商品属性列表
            List <ProductAttributeInfo> productAttributeList = Products.GetProductAttributeList(pid);

            //商品sku项列表
            DataTable productSKUItemList = AdminProducts.GetProductSKUItemList(productInfo.Pid);

            ViewData["pid"]                  = productInfo.Pid;
            ViewData["cateId"]               = productInfo.CateId;
            ViewData["categoryName"]         = vCateName;
            ViewData["productAttributeList"] = productAttributeList;
            ViewData["productSKUItemList"]   = productSKUItemList;
            ViewData["referer"]              = ShopUtils.GetAdminRefererCookie();

            return(View(model));
        }
Exemplo n.º 5
0
        public async Task <ProductResponse> EditProduct(EditProductModel edit_model)
        {
            //loop for product by id
            var existProduct = await _dbContext.Products.FindAsync(edit_model.Id);

            if (existProduct == null)
            {
                return(null);
            }

            //update
            //existProduct = _mapper.Map<Product>(edit_model);
            existProduct.Title                   = edit_model.Title;
            existProduct.ShortDescription        = edit_model.ShortDescription;
            existProduct.FullDescription         = edit_model.FullDescription;
            existProduct.Price                   = edit_model.Price;
            existProduct.PriceCurrency           = edit_model.PriceCurrency;
            existProduct.PriceDiscountValue      = edit_model.PriceDiscountValue;
            existProduct.PriceDiscountPercentage = edit_model.PriceDiscountPercentage;
            existProduct.Unit                = edit_model.Unit;
            existProduct.Category            = edit_model.Category;
            existProduct.Size                = edit_model.Size;
            existProduct.Weight              = edit_model.Weight;
            existProduct.WeightUnit          = edit_model.WeightUnit;
            existProduct.InventoryAmount     = edit_model.InventoryAmount;
            existProduct.InventoryAdjustment = edit_model.InventoryAdjustment;

            _dbContext.Products.Update(existProduct);
            await _dbContext.SaveChangesAsync();

            return(new ProductResponse {
                Status = "200", Message = "Success"
            });
        }
Exemplo n.º 6
0
        public IHttpActionResult Update(EditProductModel model)
        {
            IHttpActionResult httpActionResult;
            Product           product = db.Products.FirstOrDefault(x => x.Id == model.id);

            if (product == null)
            {
                error.Add("Not Found");
                httpActionResult = new ErrorActionResult(Request, HttpStatusCode.NotFound, error);
            }
            if (string.IsNullOrEmpty(model.Name))
            {
                error.Add("Name is required");
                httpActionResult = new ErrorActionResult(Request, HttpStatusCode.BadRequest, error);
            }
            else
            {
                product.ProductCode    = model.ProductCode ?? model.ProductCode;
                product.Name           = model.Name ?? model.Name;
                product.Price          = model.Price;
                product.PromotionPrice = model.PromotionPrice;
                product.Status         = model.Status;
                product.UpdatedDate    = DateTime.Now;
                product.UpdatedBy      = User.Identity.Name;

                db.Entry(product).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
                httpActionResult = Ok(new ProductModel(product));
            }
            return(httpActionResult);
        }
Exemplo n.º 7
0
        public IActionResult EditProduct(int ID)
        {
            string username = HttpContext.Session.GetString("username");

            if (username != null)
            {
                Product            product     = db.Products.SingleOrDefault(m => m.ID == ID);
                List <string>      ProductType = new List <string>();
                List <ProductType> productType = db.ProductTypes.ToList();
                foreach (var item in productType)
                {
                    ProductType.Add(item.Type);
                }
                EditProductModel editProductModel = new EditProductModel
                {
                    Product     = product,
                    ProductType = ProductType
                };
                ViewBag.username = username;
                return(View(editProductModel));
            }
            else
            {
                ViewBag.tips = "您还没有登录,请先登录";
                return(View("Login"));
            }
        }
Exemplo n.º 8
0
        public async Task <IActionResult> Edit(EditProductModel model)
        {
            if (!this.ModelState.IsValid)
            {
                model.AvailableCategories = this.categoriesService
                                            .All()
                                            .Select(x => new SelectListItem()
                {
                    Text     = x.Name,
                    Value    = x.Id,
                    Selected = x.Id == model.CategoryId ? true : false,
                })
                                            .ToList();
                model.AvailablePackages = this.packagesService.All().ToList();
                return(this.View(model));
            }

            try
            {
                await this.productsService.EditProductAsync(model);

                return(this.RedirectToAction("GetProducts", false));
            }
            catch (Exception e)
            {
                this.logger.LogInformation(GlobalConstants.DefaultLogPattern, this.User.Identity.Name, e.Message, e.StackTrace);
                return(this.NotFound());
            }
        }
Exemplo n.º 9
0
 public ActionResult Edit(int?id, EditProductModel model)
 {
     if (ModelState.IsValid)
     {
         using (DemoMVC5Entities db = new DemoMVC5Entities())
         {
             User user = db.User.FirstOrDefault(u => u.Login == User.Identity.Name);
             // Изменение товара
             if (user != null)
             {
                 Product product = db.Product.Find(id);          // Получаем информацию о товаре
                 if (product == null)                            // Если информация не найдена
                 {
                     RedirectToAction("PageNotFound", "Shared"); // Переходим на страницу с ошибкой
                 }
                 product.Name        = model.Name;
                 product.Description = model.Description;
                 product.Count       = model.Count;
                 product.Modified    = DateTime.Today;
                 product.ModifiedBy  = user.Id;
                 db.SaveChanges();                                // Заполняем информацию о товаре и сохраняем изменения в базе
                 return(RedirectToAction("Products", "Product")); // Переходим на страницу со списком товаров
             }
         }
     }
     return(View());
 }
Exemplo n.º 10
0
        public int EditProduct(EditProductModel editProductModel)
        {
            Account account = new Account(
                configuration["Cloudinary:CloudName"],
                configuration["Cloudinary:ApiKey"],
                configuration["Cloudinary:ApiSecret"]);

            Cloudinary cloudinary = new Cloudinary(account);
            string     fileName   = $"{Guid.NewGuid().ToString()}{System.IO.Path.GetExtension(editProductModel.ProductImage.FileName)}";

            using (Stream imageStream = editProductModel.ProductImage.OpenReadStream())
            {
                var uploadParams = new ImageUploadParams()
                {
                    File   = new FileDescription(fileName, imageStream),
                    Folder = "ProdCode"
                };
                var     uploadResult  = cloudinary.Upload(uploadParams);
                string  imageUrl      = uploadResult.JsonObj.Value <string>("url");
                Product editedProduct = this.db.Products.Single(p => p.Id == editProductModel.Id);

                editedProduct.Name     = editProductModel.ProductName;
                editedProduct.Code     = editProductModel.ProductCode;
                editedProduct.ImageUrl = imageUrl;

                this.db.SaveChanges();

                return(editedProduct.Id);
            }
        }
Exemplo n.º 11
0
        public ActionResult Edit(EditProductModel editProduct)
        {
            if (ModelState.IsValid && _productRepository.IsExists(editProduct.ProductId))
            {
                try
                {
                    var imageidList = new List <int>();

                    // Upload Product Photos
                    foreach (var file in editProduct.Files)
                    {
                        if (file != null)
                        {
                            var result = ImageHelper.UploadImage(new UploadImageModel {
                                ImageFile = file, ImageName = file.FileName
                            }, _imageRepository, Server);

                            if (result > 0)
                            {
                                imageidList.Add(result);
                            }
                        }
                    }

                    if (_productImageRepository.GetImages(editProduct.ProductId).Count == 0)
                    {
                        editProduct.ImageId = imageidList.FirstOrDefault();
                    }

                    //Create ProductImage References
                    foreach (var imageid in imageidList)
                    {
                        _productImageRepository.InsertProductImageReference(new ProductImage
                        {
                            ProductId = editProduct.ProductId,
                            ImageId   = imageid
                        });
                    }

                    //Update Product
                    var updateResult = _productRepository.UpdateProduct(editProduct);

                    if (updateResult)
                    {
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        ModelState.AddModelError("", $"Product with {editProduct.ProductId} ID was not updated!");
                    }
                }
                catch
                {
                    ModelState.AddModelError("", "Server Error!");
                }
            }

            return(View(editProduct));
        }
Exemplo n.º 12
0
        public IActionResult Create()
        {
            EditProductModel model = new EditProductModel();

            model.product    = new Product();
            model.Categories = EFPR.Categories;
            return(View("Edit", model));
        }
Exemplo n.º 13
0
        public IActionResult Edit(int productId)
        {
            EditProductModel model = new EditProductModel();

            model.product    = EFPR.Products.FirstOrDefault(x => x.ProductId == productId);
            model.Categories = EFPR.Categories;
            return(View(model));
        }
Exemplo n.º 14
0
        public async Task <IActionResult> EditProduct(EditProductModel updatedModel)
        {
            var userId        = int.Parse(User.FindFirstValue("Id"));
            var productResult = await prodService.UpdateProduct(updatedModel, userId);

            TempData["ProductStatus"] = productResult.Message;
            return(RedirectToAction("EditProduct", "Manager"));
        }
Exemplo n.º 15
0
        public ActionResult EditProduct(EditProductModel model, int pid = -1)
        {
            ProductInfo productInfo = AdminProducts.AdminGetProductById(pid);

            if (productInfo == null)
            {
                return(PromptView("商品不存在"));
            }

            int pid2 = AdminProducts.AdminGetProductIdByName(model.ProductName);

            if (pid2 > 0 && pid2 != pid)
            {
                ModelState.AddModelError("ProductName", "名称已经存在");
            }

            if (ModelState.IsValid)
            {
                productInfo.PSN          = model.PSN ?? "";
                productInfo.BrandId      = model.BrandId;
                productInfo.StoreCid     = model.StoreCid;
                productInfo.StoreSTid    = model.StoreSTid;
                productInfo.Name         = model.ProductName;
                productInfo.ShopPrice    = model.ShopPrice;
                productInfo.MarketPrice  = model.MarketPrice;
                productInfo.CostPrice    = model.CostPrice;
                productInfo.State        = model.State;
                productInfo.IsBest       = model.IsBest == true ? 1 : 0;
                productInfo.IsHot        = model.IsHot == true ? 1 : 0;
                productInfo.IsNew        = model.IsNew == true ? 1 : 0;
                productInfo.DisplayOrder = model.DisplayOrder;
                productInfo.Weight       = model.Weight;
                productInfo.Description  = model.Description ?? "";
                productInfo.Spec         = model.Spec ?? "";

                AdminProducts.UpdateProduct(productInfo, model.StockNumber, model.StockLimit);
                AddMallAdminLog("修改商品", "修改商品,商品ID为:" + pid);
                return(PromptView("商品修改成功"));
            }


            //商品属性列表
            List <ProductAttributeInfo> productAttributeList = Products.GetProductAttributeList(pid);

            //商品sku项列表
            DataTable productSKUItemList = AdminProducts.GetProductSKUItemList(productInfo.Pid);

            ViewData["pid"]                  = productInfo.Pid;
            ViewData["storeId"]              = productInfo.StoreId;
            ViewData["storeName"]            = AdminStores.GetStoreById(productInfo.StoreId).Name;
            ViewData["cateId"]               = productInfo.CateId;
            ViewData["categoryName"]         = AdminCategories.GetCategoryById(productInfo.CateId).Name;
            ViewData["productAttributeList"] = productAttributeList;
            ViewData["productSKUItemList"]   = productSKUItemList;
            ViewData["referer"]              = MallUtils.GetMallAdminRefererCookie();

            return(View(model));
        }
Exemplo n.º 16
0
 /// <summary>
 /// Update Product
 /// </summary>
 /// <param name="editCategoryModel">Product Model of Edition</param>
 public void Update(EditProductModel editProductModel)
 {
     //Update Product
     _productService.Update(editProductModel.Id,
                            editProductModel.Name,
                            editProductModel.Unit,
                            editProductModel.Price,
                            _categoryService.GetById(editProductModel.CategoryId));
 }
Exemplo n.º 17
0
 public ActionResult AddProduct()
 {
     var model = new EditProductModel
     {
         PageTitle = "Добавление нового товара",
         Categories = _categoryRepository.GetAllCategories()
             .Select(n => new SelectListItem { Text = n.Title, Value = n.Id.ToString(CultureInfo.InvariantCulture) }),
     };
     return View("EditProduct", model);
 }
Exemplo n.º 18
0
        public ActionResult EditProduct(EditProductModel model, HttpPostedFileBase[] Image)
        {
            string path = Server.MapPath(ConfigurationManager.AppSettings["imagesPath"]);

            string miniPath = Server.MapPath(ConfigurationManager.AppSettings["MiniImages"]);

            postRepository.DeleteImages(model.Id, path, miniPath);
            postRepository.EditProduct(model.Id, model.Title, model.Description, model.Quantity, model.IsIn, Image, model.categoryId, model.Price, path, miniPath);

            return(RedirectToAction("Products", "admin"));
        }
Exemplo n.º 19
0
        public async Task <IActionResult> Edit(EditProductModel input)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.View());
            }

            await this.productsService.UpdateAsync(input);

            return(this.RedirectToAction("Index"));
        }
Exemplo n.º 20
0
        public async Task <ActionResult <Product> > PostEditModel([FromForm] EditProductModel input)
        {
            if (input.Name.Length < 3 || input.Name.Length > 70)
            {
                return(this.BadRequest());
            }

            var model = await this.productsService.EditAsync(input);

            return(model);
        }
Exemplo n.º 21
0
        public async Task <IActionResult> EditProduct(string id, EditProductModel input)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.View(input));
            }

            await this.productsService.EditProductAsync(id, input.EditProductInputModel);

            return(this.Redirect($"/Administration/Administration/EditProduct?id={id}"));
        }
Exemplo n.º 22
0
 ProductDomain IMapper <ProductDomain, EditProductModel> .Map(EditProductModel source)
 {
     return(new ProductDomain
     {
         Id = source.Id,
         Category = (Category)Enum.Parse(typeof(Category), source.Category),
         Description = source.Description,
         Image = source.ImageUrl,
         Name = source.Name,
         Price = source.Price
     });
 }
Exemplo n.º 23
0
 public async Task EditProduct([FromBody] EditProductModel model)
 {
     await _client.UpdateProductMutationAsync(new Optional <UpdateProductInput>(new UpdateProductInput
     {
         Name = model.Name,
         Price = model.Price,
         InventoryId = model.InventoryId.ConvertTo <Guid>(),
         CategoryId = model.CategoryId.ConvertTo <Guid>(),
         ImageUrl = model.ImageUrl,
         Description = model.Description
     }));
 }
Exemplo n.º 24
0
        public ActionResult EditProduct(EditProductModel model)
        {
            model.Categories = _categoryRepository.GetAllCategories()
                .Select(n => new SelectListItem { Text = n.Title, Value = n.Id.ToString(CultureInfo.InvariantCulture) });

            if (ModelState.IsValid)
            {
                if (_productRepository.ExistTitleProduct(model.Title, model.Id))
                {
                    ModelState.AddModelError("Title", "Данный продукт уже есть в БД");
                    return View("EditProduct", model);
                }

                var product = _productRepository.GetProductById(model.Id) ?? new Product();
                product = Mapper.Map(model, product);
                product.ImageId = product.ImageId == 0 ? null : product.ImageId;

                if (model.Image != null)
                {
                    using (var stream = new MemoryStream())
                    {
                        model.Image.InputStream.CopyTo(stream);
                        var image = _imageRepository.GetImageById(model.ImageId) ?? new Image();
                        image.Data = stream.ToArray();

                        if (_imageRepository.ExistImage(model.ImageId))
                        {
                            _imageRepository.EditImage(image);
                        }
                        else
                        {
                            product.ImageId = _imageRepository.AddImage(image);
                        }
                    }
                }

                if (_productRepository.ExistProduct(model.Id))
                {
                    product.ModificationDate = DateTime.Now;
                    _productRepository.EditProduct(product);
                }
                else
                {
                    product.CreationDate = DateTime.Now;
                    product.ModificationDate = DateTime.Now;
                    _productRepository.AddProduct(product);
                }

                return RedirectToAction("Index");
            }

            return View("EditProduct", model);
        }
        public ActionResult EditProduct(int product_id)
        {
            EditProductModel result = new EditProductModel();

            result = _proM.GetEditProductModel(product_id, CurrentUser.CurrentUser.ID);

            if (result == null)
            {
                return(RedirectToAction("NotAuthority", "Home"));
            }

            return(View(result));
        }
        public ResponseModel ValidateEditProduct(EditProductModel product)
        {
            ResponseModel result = new ResponseModel();

            if (string.IsNullOrWhiteSpace(product.Name) || string.IsNullOrWhiteSpace(product.Description) || string.IsNullOrWhiteSpace(product.Uri))
            {
                result.Message = "Ürün ismi, açıklaması ve url bilgisi zorunludur!";
                return(result);
            }

            result.IsSuccess = true;
            return(result);
        }
Exemplo n.º 27
0
        public EditProductModel GetEditProductById(string productId)
        {
            var product = this.CheckNullExistsReturnProduct(productId);

            var packages = this.GetAvailablePackigesVM;

            var model = new EditProductModel()
            {
                Id                = product.Id,
                Name              = product.Name,
                ImageUrl          = product.ImageUrl,
                CategoryId        = product.CategoryId,
                Description       = product.Description,
                HasExtras         = product.HasExtras,
                AvailablePackages = packages,
            };

            model.Allergens = this.allergensRepository
                              .All()
                              .ToList()
                              .Select(c => new SelectListItem()
            {
                Value    = c.Id,
                Text     = c.Name,
                Selected = product.Allergens.Any(a => a.AllergenId == c.Id),
            }).ToList();
            model.AvailableCategories = this.categoriesRepository
                                        .All()
                                        .Select(c => new SelectListItem()
            {
                Value    = c.Id,
                Text     = c.Name,
                Selected = product.CategoryId == c.Id,
            }).ToList();
            model.Sizes = this.sizeRepository
                          .All()
                          .Where(c => c.MenuProductId == product.Id)
                          .Select(c => new EditProductSizeModel()
            {
                SizeId               = c.Id,
                SizeName             = c.SizeName,
                Price                = c.Price,
                Weight               = c.Weight,
                PackageId            = c.PackageId,
                MaxProductsInPackage = c.MaxProductsInPackage,
                MistralCode          = c.MistralCode,
                MistralName          = c.MistralName,
            }).ToList();
            return(model);
        }
Exemplo n.º 28
0
        public async Task <ActionResult <Product> > EditUser(EditProductModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            var product = await _repo.EditProduct(model);

            if (product != null)
            {
                return(product);
            }
            return(BadRequest());
        }
Exemplo n.º 29
0
        public IActionResult Save(EditProductModel productmodel)
        {
            Product product = productmodel.product;

            if (ModelState.IsValid)
            {
                EFPR.SaveItem(product);
                return(RedirectToAction("Index"));
            }
            else
            {
                TempData["message"] = "Podane parametry są nie poprawne";
                return(View("Edit", productmodel));
            }
        }
Exemplo n.º 30
0
        public ActionResult EditFeatured(EditProductModel model)
        {
            int productId = model.Id;

            foreach (var feature in model.ProductFeatures)
            {
                if (feature.ProductId == 0)
                {
                    feature.ProductId = productId;
                }
                _productFeaturesService.AddOrUpdate(feature);
            }

            return(RedirectToAction("Edit", "Product", new { id = model.Id }));
        }
Exemplo n.º 31
0
        public ActionResult EditSpecs(EditProductModel model)
        {
            int productId = model.Id;

            foreach (var product in model.ProductSpecs)
            {
                if (product.ProductId == 0)
                {
                    product.ProductId = productId;
                }
                _productSpecsService.AddOrUpdate(product);
            }

            return(RedirectToAction("Edit", "Product", new { id = model.Id }));
        }
Exemplo n.º 32
0
        public ActionResult EditProduct(int id)
        {
            Product product = postRepository.GetProductById(id);

            if (product != null)
            {
                EditProductModel model = new EditProductModel()
                {
                    Id = product.Id, Title = product.Title, Description = product.Description, IsIn = product.IsIn, Quantity = product.Quantity, Price = product.Price, categoryId = product.CategoryId
                };
                ViewBag.ListCategory = categoryRepository.GetAllCategory().ToList();
                return(View(model));
            }
            return(View());
        }
        public ActionResult Create(EditProductModel model)
        {
            if (ModelState.IsValid)
            {
                if (model.Image != null)
                {
                    model.ImageUrl = this.imageService.SaveImage(model.Image.FileName, model.Image.InputStream);
                }
                else
                {
                    model.ImageUrl = "~/images/none.jpg";
                }

                var entity = this.editMapper.Map(model);
                var result = this.service.CreateProduct(entity);

                if (!result.Succeeded)
                {
                    this.AddErrors(result);
                }
            }

            return View("Edit", model);
        }
 public ActionResult Create()
 {
     var model = new EditProductModel();
     return View("Create", model);
 }