Ejemplo n.º 1
0
        public ActionResult SaveOrUpdate(Supplier supplier)
        {
            try
            {
                if (supplier.Id > 0)
                {
                    supplier = this.SupplierRepository.Get(supplier.Id);

                    TryUpdateModel(supplier);
                }

                if (supplier.Pinyin.IsNullOrEmpty() && !supplier.Name.IsNullOrEmpty())
                {
                    supplier.Pinyin = ChineseToSpell.GetChineseSpell(supplier.Name);
                }

                supplier = this.SupplierRepository.SaveOrUpdate(supplier);

                return JsonSuccess(supplier);

            }
            catch (Exception ex)
            {
                return JsonError(ex.Message);
            }
        }
Ejemplo n.º 2
0
        public ActionResult Edit(int? id)
        {
            Supplier item = null;

            if (id.HasValue)
            {
                item = this.SupplierRepository.Get(id.Value);
            }

            if (item == null)
            {
                item = new Supplier();
            }

            return View(item);
        }
Ejemplo n.º 3
0
 public static SupplierModel From(Supplier supplier)
 {
     return new SupplierModel(supplier);
 }
Ejemplo n.º 4
0
        public SupplierModel(Supplier supplier)
            : base(supplier)
        {
            if (supplier.SupplierType != null)
            {
                this.SupplierTypeId = supplier.SupplierType.Id;
                this.SupplierTypeString = supplier.SupplierType.Name;
            }

            this.ShuiHao = supplier.ShuiHao;
            this.CardNo = supplier.CardNo;
            this.TaxRate = supplier.TaxRate;
            this.FukuanQc = supplier.FukuanQc;
            this.FukuanYing = supplier.FukuanYing;
            this.FukuanYu = supplier.FukuanYu;
        }