public ActionResult Update(Supplier supplier) { try { var aSupplier = _supplier.GetSupplierById(supplier.Code); if (aSupplier != null) { aSupplier.Code = supplier.Code; aSupplier.Name = supplier.Name; aSupplier.Address = supplier.Address; aSupplier.Email = supplier.Email; aSupplier.Contact = supplier.Contact; aSupplier.ContactPerson = supplier.ContactPerson; var isUpdate = _supplier.Update(aSupplier); if (isUpdate) { ViewBag.SUpdate = "Update Success."; } else { ViewBag.FUpdate = "Update Failed."; } } else { ViewBag.FMsg = "Supplier not found."; } } catch (Exception exception) { ViewBag.FMsg = exception.Message; } return(View()); }
public ActionResult Update(string code) { var aSupplier = _supplier.GetSupplierById(code); return(View(aSupplier)); }