public async Task <IActionResult> Edit(int id, [Bind("Id,Cpf,Name,BirthDate,Gender,Phone,Email,SalesRecord,Cep,State,City,District,Address,Number,Complement")] Client client) { if (id != client.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(client); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClientExists(client.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(client)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,ProductName,ProductDescription,ProductPrice,ProductQuantity,TypeProductId")] 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["TypeProductId"] = new SelectList(_context.TypeProduct, "Id", "TypeProdName", product.TypeProductId); return(View(product)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,Age,Gender,DepartmentId,Salary,ProfilePicture")] 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))); } ViewData["DepartmentId"] = new SelectList(_context.Department, "Id", "DepartmentName", employee.DepartmentId); return(View(employee)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,SaleTime,EmployeeId,ProductId,ClientId")] 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["ClientId"] = new SelectList(_context.Client, "Id", "Address", sale.ClientId); ViewData["EmployeeId"] = new SelectList(_context.Employee, "Id", "FirstName", sale.EmployeeId); ViewData["ProductId"] = new SelectList(_context.Product, "Id", "ProductName", sale.ProductId); return(View(sale)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,DepartmentName")] Department department) { if (id != department.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(department); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DepartmentExists(department.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(department)); }