public IActionResult Create() { var creditRatingLookup = CreditRatingLookupCollection.CreditRatingStatuses(); ViewBag.CreditRatingLookup = creditRatingLookup; return(View(new VendorDomainObj { })); }
public async Task <IActionResult> Edit(int id) { var vendor = await _repository.Vendor.GetVendorByID(id); if (vendor == null) { return(NotFound()); } var creditRatingLookup = CreditRatingLookupCollection.CreditRatingStatuses(); ViewBag.CreditRatingLookup = creditRatingLookup; return(View(vendor)); }
public async Task <IActionResult> Edit([FromForm] VendorDomainObj vendor) { if (ModelState.IsValid) { try { await _repository.Vendor.UpdateVendor(vendor); } catch (Exception ex) { ModelState.AddModelError(nameof(VendorDomainObj), ex.Message); var creditRatingLookup = CreditRatingLookupCollection.CreditRatingStatuses(); ViewBag.CreditRatingLookup = creditRatingLookup; return(View(vendor)); } } else { return(View(vendor)); } return(RedirectToAction(nameof(List))); }