public async Task <IActionResult> adjust(Customer cus) { var customerFind = await _context.Customer .FirstOrDefaultAsync(m => m.Id == cus.Id); customerFind.Address = cus.Address; customerFind.Phone = cus.Phone; customerFind.Name = cus.Name; _context.Entry(customerFind).State = EntityState.Modified; //_context.Update(customer); await _context.SaveChangesAsync(); //try //{ // _context.Update(customer); // await _context.SaveChangesAsync(); //} //catch (DbUpdateConcurrencyException) //{ // if (!CustomerExists(customer.Id)) // { // return NotFound(); // } // else // { // throw; // } //} return(RedirectToRoute("customer")); }
public async Task <IActionResult> adjust(Product cus) { var productFind = await _context.Product .FirstOrDefaultAsync(m => m.Id == cus.Id); productFind.Price = cus.Price; productFind.Name = cus.Name; _context.Entry(productFind).State = EntityState.Modified; //_context.Update(product); await _context.SaveChangesAsync(); return(RedirectToRoute("product")); }
public async Task <IActionResult> adjust(Store cus) { var storeFind = await _context.Store .FirstOrDefaultAsync(m => m.Id == cus.Id); storeFind.Address = cus.Address; storeFind.Name = cus.Name; _context.Entry(storeFind).State = EntityState.Modified; //_context.Update(store); await _context.SaveChangesAsync(); return(RedirectToRoute("store")); }
public async Task <IActionResult> adjust(TransactionHead cus) { var salesFind = await _context.TransactionHead .FirstOrDefaultAsync(m => m.Id == cus.Id); salesFind.StaffId = cus.StaffId; salesFind.StoreId = cus.StoreId; salesFind.Date = cus.Date; salesFind.CustomerId = cus.CustomerId; salesFind.ProductId = cus.ProductId; _context.Entry(salesFind).State = EntityState.Modified; //_context.Update(sales); await _context.SaveChangesAsync(); return(RedirectToRoute("sales")); }