public async Task <IActionResult> Edit(int id, [Bind("Id,Category_Name,Category_Status")] 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));
        }
Пример #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Order_Quantity,Order_Status,ProductId,SignupId")] 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["ProductId"] = new SelectList(_context.Set <Product>(), "Id", "Product_Name", order.ProductId);
            ViewData["SignupId"]  = new SelectList(_context.Signup, "Id", "Signup_Email", order.SignupId);
            return(View(order));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Signup_Name,Signup_Email,Signup_Subject,Signup_Massage")] Signup signup)
        {
            if (id != signup.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(signup);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SignupExists(signup.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(signup));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Product_Name,Product_Description,Product_Type,Product_Material,Product_Color,Product_Size,Product_Rating,Product_Price,BrandId,CategoryId")] 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)));
            }
            ViewData["BrandId"]    = new SelectList(_context.Brand, "Id", "Brand_Name", product.BrandId);
            ViewData["CategoryId"] = new SelectList(_context.Category, "Id", "Category_Name", product.CategoryId);
            return(View(product));
        }