Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name")] 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)));
            }
            return(View(customer));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,FirstName,Surname")] Employee employee)
        {
            if (id != employee.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employee);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeeExists(employee.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(employee));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Units")] PartType partType)
        {
            if (id != partType.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(partType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PartTypeExists(partType.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(partType));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,PartID,StockID,ArrDate,Quantity")] Left left)
        {
            if (id != left.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(left);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LeftExists(left.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PartID"]  = new SelectList(_context.Parts, "ID", "ID", left.PartID);
            ViewData["StockID"] = new SelectList(_context.Stocks, "ID", "ID", left.StockID);
            return(View(left));
        }