コード例 #1
0
        public ActionResult Get(int id)
        {
            if (id <= 0)
            {
                return(Json(new ResultModel(string.Format("{0}不存在", this.ModelName))));
            }

            SupplierBLL dal    = new SupplierBLL();
            ResultModel result = dal.Get(id);

            if (result.ResultStatus != 0)
            {
                return(Json(result));
            }

            object rtnObj = result.ReturnValue;

            if (rtnObj == null)
            {
                return(Json(new ResultModel(string.Format("{0}不存在", this.ModelName))));
            }

            result.ResultStatus = 0;
            result.Message      = string.Format("{0}获取成功", this.ModelName);
            result.ReturnValue  = Newtonsoft.Json.JsonConvert.SerializeObject(rtnObj);
            return(Json(result));
        }
コード例 #2
0
        public ActionResult Update(Supplier supplier)
        {
            SupplierBLL supBLL = new SupplierBLL();

            //获取客户信息
            ResultModel <Supplier> supResult = supBLL.Get <Supplier>(supplier.SupId);

            if (supResult == null || supResult.ResultStatus != 0)
            {
                new ResultModel("用户获取失败或不存在");
            }

            Supplier rtnSupplier = supResult.ReturnValue;

            if (rtnSupplier == null || rtnSupplier.SupId <= 0)
            {
                new ResultModel("用户获取失败或不存在");
            }

            rtnSupplier.SupCode       = supplier.SupCode;
            rtnSupplier.SupName       = supplier.SupName;
            rtnSupplier.SupEName      = supplier.SupEName;
            rtnSupplier.SupAddress    = supplier.SupAddress;
            rtnSupplier.SupContacts   = supplier.SupContacts;
            rtnSupplier.SupTel        = supplier.SupTel;
            rtnSupplier.SupFax        = supplier.SupFax;
            rtnSupplier.SupZip        = supplier.SupZip;
            rtnSupplier.SupEmail      = supplier.SupEmail;
            rtnSupplier.Bank          = supplier.Bank;
            rtnSupplier.BankAccount   = supplier.BankAccount;
            rtnSupplier.ServiceAmount = supplier.ServiceAmount;
            rtnSupplier.Memo          = supplier.Memo;

            ResultModel result = supBLL.Update(supplier);

            if (result.ResultStatus != 0)
            {
                return(Json(result));
            }

            result.Message      = "用户修改成功";
            result.ReturnValue  = "";
            result.ResultStatus = 0;
            return(Json(result));
        }