public async Task <IActionResult> Edit(int id, [Bind("ProductId,AccessoryTypeId")] Accessories accessories)
        {
            if (id != accessories.ProductId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(accessories);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AccessoriesExists(accessories.ProductId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AccessoryTypeId"] = new SelectList(_context.AccessoryTypes, "AccessoryTypeId", "AccessoryType", accessories.AccessoryTypeId);
            ViewData["ProductId"]       = new SelectList(_context.Products, "ProductId", "ProductName", accessories.ProductId);
            return(View(accessories));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("ProductId,ProductImagePath")] ProductPictures productPictures)
        {
            if (id != productPictures.ProductId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(productPictures);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductPicturesExists(productPictures.ProductId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProductId"] = new SelectList(_context.Products, "ProductId", "ProductName", productPictures.ProductId);
            return(View(productPictures));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("OrderId,OrderDate,OrderPrice,DriverNo,DeliveryDate,IsPaid,IsProductBinEmpty,UserId,PaymentId")] Orders orders)
        {
            if (id != orders.OrderId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(orders);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrdersExists(orders.OrderId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PaymentId"] = new SelectList(_context.Payments, "PaymentId", "PaymentType", orders.PaymentId);
            ViewData["UserId"]    = new SelectList(_context.WebUsers, "UserId", "Address", orders.UserId);
            return(View(orders));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Edit(int id, [Bind("CategoryId,CategoryName,CategoryDescription,CategoryPicturePath")] Categories categories, IFormFile _Image)
        {
            if (id != categories.CategoryId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                if (_Image != null)
                {
                    SaveCatg_Image(categories, _Image);
                    _context.SaveChanges();
                }
                try
                {
                    _context.Update(categories);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CategoriesExists(categories.CategoryId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(categories));
        }
        public async Task <IActionResult> Edit(int id, [Bind("AdminShopId,UserName,UserPassword,ShopName,ShopEmail,PhoneNo,ShopAddress")] Adminshop adminshop)
        {
            if (id != adminshop.AdminShopId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(adminshop);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AdminshopExists(adminshop.AdminShopId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(adminshop));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ProductId,CategoryId,BrandId,ProductName,ProductDescription,ProductQuantity,ProductPrice,Discount,VendorName,ProductColor,ProductRate,IsOffer")] Products products)
        {
            if (id != products.ProductId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(products);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductsExists(products.ProductId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BrandId"]    = new SelectList(_context.Brands, "BrandId", "BrandName", products.BrandId);
            ViewData["CategoryId"] = new SelectList(_context.Categories, "CategoryId", "CategoryName", products.CategoryId);
            return(View(products));
        }
Exemplo n.º 7
0
        public async Task <IActionResult> Edit(int id, [Bind("PaymentId,PaymentType")] Payments payments)
        {
            if (id != payments.PaymentId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(payments);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PaymentsExists(payments.PaymentId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(payments));
        }
Exemplo n.º 8
0
        public async Task <IActionResult> Edit(int id, [Bind("UserId,MessageBody,MessageDate,ProductId")] UserProductComments userProductComments)
        {
            if (id != userProductComments.UserId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(userProductComments);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserProductCommentsExists(userProductComments.UserId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProductId"] = new SelectList(_context.Products, "ProductId", "ProductName", userProductComments.ProductId);
            ViewData["UserId"]    = new SelectList(_context.WebUsers, "UserId", "Address", userProductComments.UserId);
            return(View(userProductComments));
        }
Exemplo n.º 9
0
        public async Task <IActionResult> Edit(int id, [Bind("AccessoryTypeId,AccessoryType")] AccessoryTypes accessoryTypes)
        {
            if (id != accessoryTypes.AccessoryTypeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(accessoryTypes);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AccessoryTypesExists(accessoryTypes.AccessoryTypeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(accessoryTypes));
        }
        public async Task <IActionResult> Edit(int id, [Bind("OrderId,ProductId,UnitPrice,SellingPrice,Quantity")] OrderDetails orderDetails)
        {
            if (id != orderDetails.OrderId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(orderDetails);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrderDetailsExists(orderDetails.OrderId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["OrderId"]   = new SelectList(_context.Orders, "OrderId", "OrderId", orderDetails.OrderId);
            ViewData["ProductId"] = new SelectList(_context.Products, "ProductId", "ProductName", orderDetails.ProductId);
            return(View(orderDetails));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ProductId,ScreenSize,ScreenType,Ram,CameraPropertry,Battery,ModeNo,FingerPrint,WaterResist,Processor,HardType,HardStorage,Genaration,ExtraProperty")] LaptopProperties laptopProperties)
        {
            if (id != laptopProperties.ProductId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(laptopProperties);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LaptopPropertiesExists(laptopProperties.ProductId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProductId"] = new SelectList(_context.Products, "ProductId", "ProductName", laptopProperties.ProductId);
            return(View(laptopProperties));
        }
Exemplo n.º 12
0
        public async Task <IActionResult> Edit(int id, [Bind("UserId,UserName,UserPassword,UserImagePath,Address,PostCode,Phone,BirthDate,IsOnline,NoOfAccess,CreationDate,NoOfBlock")] WebUsers webUsers)
        {
            if (id != webUsers.UserId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(webUsers);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!WebUsersExists(webUsers.UserId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(webUsers));
        }
Exemplo n.º 13
0
        public async Task <IActionResult> Edit(int id, [Bind("BrandId,BrandName,BrandDescription,BrandLogoPicturePath")] Brands brands, IFormFile _Imag)
        {
            if (id != brands.BrandId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                if (_Imag != null)
                {
                    SaveBrand_Image(brands, _Imag);
                    _context.SaveChanges();
                }
                try
                {
                    _context.Update(brands);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BrandsExists(brands.BrandId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(brands));
        }
Exemplo n.º 14
0
        public async Task <IActionResult> Edit(int id, [Bind("ErrId,ErrMessage,ErrDate,ErrPageName,ErrLine,ErrDetails")] ErrorTb errorTb)
        {
            if (id != errorTb.ErrId)
            {
                return(NotFound());
            }

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