public async Task <IActionResult> Edit(int id, [Bind("Id,Title")] VendorTypeValue vendorTypeValue, int typeId) { if (id != vendorTypeValue.Id) { return(NotFound()); } var parms = new Dictionary <string, string> { { "typeId", typeId.ToString() } }; if (ModelState.IsValid) { try { var vendortype = _context.VendorTypes.Find(typeId); vendorTypeValue.VendorType = vendortype; _context.Update(vendorTypeValue); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VendorTypeValueExists(vendorTypeValue.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index), parms)); } return(View(vendorTypeValue)); }
public async Task <IActionResult> Create([Bind("Id,Title")] VendorTypeValue vendorTypeValue, int typeId) { if (ModelState.IsValid) { var vendortype = _context.VendorTypes.Find(typeId); vendorTypeValue.VendorType = vendortype; _context.Add(vendorTypeValue); await _context.SaveChangesAsync(); var parms = new Dictionary <string, string> { { "typeId", typeId.ToString() } }; return(RedirectToAction(nameof(Index), parms)); } return(View(vendorTypeValue)); }