public async Task <IActionResult> Edit(long id, [Bind("ID,Code,Barcode,Name,CostPrice,Utility,SalePrice,Stock,State,CategoryID")] 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("Index")); } ViewData["CategoryID"] = new SelectList(_context.Category, "ID", "ID", product.CategoryID); return(View(product)); }
public async Task <IActionResult> Edit(long id, [Bind("ID,NumberBill,Date,Subtotal,Iva,Total,SupplierID")] BillPurchase billPurchase) { if (id != billPurchase.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(billPurchase); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BillPurchaseExists(billPurchase.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["SupplierID"] = new SelectList(_context.Supplier, "ID", "ID", billPurchase.SupplierID); return(View(billPurchase)); }
public async Task <IActionResult> Edit(string id, [Bind("ID,ROW_ID,SUB_ID,LOCATION_ADDRESS")] PREMISE_DETAILS pREMISE_DETAILS) { if (id != pREMISE_DETAILS.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(pREMISE_DETAILS); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PREMISE_DETAILSExists(pREMISE_DETAILS.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(pREMISE_DETAILS)); }
public async Task <IActionResult> Edit(long id, [Bind("ID,Ruc,Name,City,Address,Phone,NameContactPerson,SkypeUserContactPerson")] Supplier supplier) { if (id != supplier.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(supplier); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SupplierExists(supplier.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(supplier)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,TypeID,Value,CreatedAt")] BillMeasure billMeasure) { if (id != billMeasure.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(billMeasure); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BillMeasureExists(billMeasure.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["TypeID"] = new SelectList(_context.BillTypes, "Id", "Name", billMeasure.TypeID); return(View(billMeasure)); }
public async Task <IActionResult> Edit(string id, [Bind("bill_id,date_generated,due_date,cust_id,premise_id,address,amount,status")] Bill_Information bill_Information) { if (id != bill_Information.bill_id) { return(NotFound()); } if (ModelState.IsValid) { try { BillDatabaseModel model = new BillDatabaseModel { address = bill_Information.address, amount = bill_Information.amount, bill_id = bill_Information.bill_id, cust_id = bill_Information.cust_id, date_generated = bill_Information.date_generated, due_date = bill_Information.due_date, premise_id = bill_Information.premise_id, status = bill_Information.status }; _context.Update(model); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!Bill_InformationExists(bill_Information.bill_id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(bill_Information)); }
public async Task <ActionResult <Bill> > UpdateBill(int id, [FromBody] Bill bill) { int rowsAffected = 0; try { bill.Id = id; dbContext.Update(bill); rowsAffected = await dbContext.SaveChangesAsync(); return(bill); } catch (DbUpdateException e) { if (rowsAffected == 0) { return(new NotFoundObjectResult(new NotFoundException("bill"))); } else { throw e; } } }