public async Task <IActionResult> Edit(int id, [Bind("Id,CustomerGuid,Username,Email,Password,PasswordFormatId,PasswordSalt,AdminComment,IsTaxExempt,AffiliateId,VendorId,HasShoppingCartItems,Active,Deleted,IsSystemAccount,SystemName,LastIpAddress,CreatedOnUtc,LastLoginDateUtc,LastActivityDateUtc,BillingAddressId,ShippingAddressId")] Customer customer)
        {
            if (id != customer.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(customer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CustomerExists(customer.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BillingAddressId"]  = new SelectList(_context.Address, "Id", "Id", customer.BillingAddressId);
            ViewData["ShippingAddressId"] = new SelectList(_context.Address, "Id", "Id", customer.ShippingAddressId);
            return(View(customer));
        }
Example #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,OrderGuid,CustomerId,BillingAddressId,ShippingAddressId,OrderTotal,Deleted,CreatedOnUtc")] Order order)
        {
            if (id != order.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(order);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrderExists(order.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BillingAddressId"]  = new SelectList(_context.Address, "Id", "Id", order.BillingAddressId);
            ViewData["CustomerId"]        = new SelectList(_context.Customer, "Id", "Id", order.CustomerId);
            ViewData["ShippingAddressId"] = new SelectList(_context.Address, "Id", "Id", order.ShippingAddressId);
            return(View(order));
        }
Example #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,PictureBinary,MimeType,SeoFilename,AltAttribute,TitleAttribute,IsNew")] Picture picture)
        {
            if (id != picture.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(picture);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PictureExists(picture.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(picture));
        }
Example #4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description,CategoryTemplateId,MetaKeywords,MetaDescription,MetaTitle,ParentCategoryId,PictureId,PageSize,AllowCustomersToSelectPageSize,PageSizeOptions,PriceRanges,ShowOnHomePage,IncludeInTopMenu,HasDiscountsApplied,SubjectToAcl,LimitedToStores,Published,Deleted,DisplayOrder,CreatedOnUtc,UpdatedOnUtc")] Category category)
        {
            if (id != category.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(category);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CategoryExists(category.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(category));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,ProductTypeId,ParentGroupedProductId,VisibleIndividually,Name,ShortDescription,FullDescription,AdminComment,ProductTemplateId,ShowOnHomePage,MetaKeywords,MetaDescription,MetaTitle,IsRental,RentalPriceLength,RentalPricePeriodId,IsTaxExempt,TaxCategoryId,StockQuantity,DisplayStockAvailability,DisplayStockQuantity,MinStockQuantity,OrderMinimumQuantity,OrderMaximumQuantity,DisableBuyButton,DisableWishlistButton,Price,OldPrice,SpecialPrice,SpecialPriceStartDateTimeUtc,SpecialPriceEndDateTimeUtc,Weight,Length,Width,Height,AvailableStartDateTimeUtc,AvailableEndDateTimeUtc,DisplayOrder,Published,Deleted,CreatedOnUtc,UpdatedOnUtc")] Product product)
        {
            if (id != product.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(product);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductExists(product.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(product));
        }