public bool Add() { if (this.Valid()) { this.Id = General.UniqueString(this.Id); using (WMContext context = new WMContext()) { OrderGoods model = new OrderGoods { Id = this.Id, OrderId = this.OrderId, GoodId = this.GoodId, Price = this.Price, Count = this.Count }; context.OrderGoods.Add(model); context.SaveChanges(); } return(true); } return(false); }
public bool Add() { if (this.Valid()) { this.Id = General.UniqueString(this.Id); using (WMContext context = new WMContext()) { OrderGoods model = new OrderGoods { Id = this.Id, OrderId = this.OrderId, GoodId = this.GoodId, Price = this.Price, Count = this.Count }; context.OrderGoods.Add(model); context.SaveChanges(); } return true; } return false; }