Example #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Code,Name,Address,City,State,Zip,Phone,Email")] Vendor vendor)
        {
            if (id != vendor.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(vendor);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VendorExists(vendor.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(vendor));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Description,Justification,RejectionReason,DeliveryMode,Status,Total,UserId")] Request request)
        {
            if (id != request.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(request);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RequestExists(request.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.Users, "Id", "Firstname", request.UserId);
            return(View(request));
        }
Example #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,RequestId,ProductId,Quantity")] RequestLine requestLine)
        {
            if (id != requestLine.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(requestLine);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RequestLineExists(requestLine.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProductId"] = new SelectList(_context.Products, "Id", "Name", requestLine.ProductId);
            ViewData["RequestId"] = new SelectList(_context.Requests, "Id", "DeliveryMode", requestLine.RequestId);
            return(View(requestLine));
        }
Example #4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Username,Password,Firstname,Lastname,Phone,Email,IsReviewer,IsAdmin")] User user)
        {
            if (id != user.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(user);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserExists(user.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
Example #5
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,PartNbr,Name,Price,Unit,Photopath,VendorId")] 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["VendorId"] = new SelectList(_context.Vendors, "Id", "Address", product.VendorId);
            return(View(product));
        }