public async Task <IActionResult> Edit(Guid id, [Bind("BillOfMaterialsExpandedId,BomLevel,TopLevelItem,TopLevelDescription,ParentItem,ParentDescription,ComponentItem,ComponentDescription,QuantityPerTop,QuantityPerParent,PurchasedOrManufactured,ScrapPercentage,BomSequence,FullSequence,ParentId,HasChild,StandardCost,LineCost,ManufacturerCodes,BomDate,BomReference,BomRelease")] BillOfMaterialsExpanded billOfMaterialsExpanded) { if (id != billOfMaterialsExpanded.BillOfMaterialsExpandedId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(billOfMaterialsExpanded); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BillOfMaterialsExpandedExists(billOfMaterialsExpanded.BillOfMaterialsExpandedId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(billOfMaterialsExpanded)); }
public async Task <IActionResult> Create([Bind("BillOfMaterialsExpandedId,BomLevel,TopLevelItem, TopLevelDescription,ParentItem,ParentDescription,ComponentItem,ComponentDescription,QuantityPerTop,QuantityPerParent,PurchasedOrManufactured,ScrapPercentage,BomSequence,FullSequence,ParentId,HasChild,StandardCost,LineCost,ManufacturerCodes,BomDate,BomReference,BomRelease")] BillOfMaterialsExpanded billOfMaterialsExpanded) { if (ModelState.IsValid) { billOfMaterialsExpanded.BillOfMaterialsExpandedId = Guid.NewGuid(); _context.Add(billOfMaterialsExpanded); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(billOfMaterialsExpanded)); }
public IActionResult Post(string values) { var newBomExpanded = new BillOfMaterialsExpanded(); JsonConvert.PopulateObject(values, newBomExpanded); if (!TryValidateModel(newBomExpanded)) { return(BadRequest()); //(ModelState.GetFullErrorMessage()); } _context.BillOfMaterialsExpanded.Add(newBomExpanded); _context.SaveChanges(); return(Ok()); }