/// <summary> /// 新增客戶 /// </summary> /// <param name="code"></param> /// <param name="customerName"></param> public CustomerInfo NewCustomer(string code, string customerName) { CustomerInfo newCustomer=new CustomerInfo(){ Customer_Code=code , Customer_Name=customerName , Prefix=this.GetPrefix(customerName) }; int count = this.DB.Items.Count(r => r.Prefix == newCustomer.Prefix); count += 1; newCustomer.New_Code = newCustomer.Prefix + count.ToString("000"); this.DB.Items.Add(newCustomer); this.SaveChangeToSotrage(); return newCustomer; }
public ActionResult Create(CustomerInfo data) { GroupageCore.CustomerBLL bll = new GroupageCore.CustomerBLL(); CustomerInfo added = bll.NewCustomer(data.Customer_Code, data.Customer_Name); return RedirectToAction("Detail", new { id = added.New_Code }); }