Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,ProductId,StoreId,CustomerId,DateSold")] Sale sale)
        {
            if (id != sale.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(sale);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SaleExists(sale.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerId"] = new SelectList(_context.Customer, "Id", "Address", sale.CustomerId);
            ViewData["ProductId"]  = new SelectList(_context.Product, "Id", "Name", sale.ProductId);
            ViewData["StoreId"]    = new SelectList(_context.Store, "Id", "Address", sale.StoreId);
            return(View(sale));
        }
Пример #2
0
        public async Task <IActionResult> Edit(int id, [Bind("EmployeeId,Name,Position,Age,Salatry")] Employee employee)
        {
            if (id != employee.EmployeeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employee);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeeExists(employee.EmployeeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(employee));
        }
Пример #3
0
        public async Task <IActionResult> Edit(long id, [Bind("Id,FirstName,LastName,Email,MobileNo")] 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));
        }
Пример #4
0
        public async Task <IActionResult> Edit(int id, [Bind("id,model,year,cylinders,MakeId")] CarModel carModel)
        {
            if (id != carModel.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(carModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CarModelExists(carModel.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MakeId"] = new SelectList(_context.Make, "id", "name", carModel.MakeId);
            return(View(carModel));
        }
Пример #5
0
        public async Task <IActionResult> Edit(int id, [Bind("id,name")] MakeModel makeModel)
        {
            if (id != makeModel.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(makeModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MakeModelExists(makeModel.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(makeModel));
        }
 public void UpdateFileTask(FileTaskEntity task)
 {
     _context.Update(task);
     _context.SaveChanges();
 }