Exemplo n.º 1
0
        public ActionResult Create(string Brand, ProductDetailsVM viewModel)
        {
            try
            {
                string uniqueFileName = FileUpload(viewModel);

                ProductDetails details = new ProductDetails
                {
                    Battery            = viewModel.Battery,
                    DisplaySize        = viewModel.DisplaySize,
                    isBluetoothSupport = viewModel.isBluetoothSupport,
                    isWIFISupport      = viewModel.isWIFISupport,
                    Name            = viewModel.Name,
                    OperatingSystem = viewModel.OperatingSystem,
                    Processor       = viewModel.Processor,
                    SimDetails      = viewModel.SimDetails,
                    weight          = viewModel.weight,
                    Image           = uniqueFileName,
                    BrandId         = int.Parse(Brand)
                };
                _product.Create(details);
                return(RedirectToAction(nameof(Index)));
            }
            catch (Exception ex)
            {
                return(View());
            }
        }
 public ActionResult Create(MobileBrand entity)
 {
     try
     {
         _brand.Create(entity);
         return(RedirectToAction(nameof(Index)));
     }
     catch (Exception ex)
     {
         return(View());
     }
 }
 public ActionResult Create(ProductDetails entity)
 {
     try
     {
         _product.Create(entity);
         return(RedirectToAction(nameof(Index)));
     }
     catch
     {
         return(View());
     }
 }