Exemplo n.º 1
0
        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());
        }