Esempio n. 1
0
        public async Task <IActionResult> UpdatePurse(int productId)
        {
            var model = new UpdatePurseViewModel();

            var currentPurse = await _PursesRepository.SelectOnePurse(productId);

            model.NewPurseName = string.Empty;
            model.OldPurseName = currentPurse.PurseName;

            model.NewBrand = string.Empty;
            model.OldBrand = currentPurse.Brand;

            model.NewDescription = string.Empty;
            model.OldDescription = currentPurse.Description;

            model.NewColor = string.Empty;
            model.OldColor = currentPurse.Color;

            model.NewPrice = default(int);
            model.OldPrice = currentPurse.Price;

            model.ProductId = productId;

            return(View(model));
        }
Esempio n. 2
0
        public IActionResult UpdatePurse(UpdatePurseViewModel model)
        {
            var dboPurse = new PursesDBO();

            dboPurse.PurseName   = model.NewPurseName;
            dboPurse.Brand       = model.NewBrand;
            dboPurse.Price       = model.NewPrice;
            dboPurse.Color       = model.NewColor;
            dboPurse.Description = model.NewDescription;
            dboPurse.ProductId   = model.ProductId;

            _PursesRepository.UpdateSelectedPurses(dboPurse);

            return(RedirectToAction(nameof(Purses)));
        }