public Payment getPayment() { EcommercePlatformDataContext db = new EcommercePlatformDataContext(); Payment p = new Payment(); try { p = db.Payments.Where(x => x.ID == this.payment_id).First<Payment>(); } catch { }; return p; }
internal void AddPayment(string type, string confirmKey, string status) { EcommercePlatformDataContext db = new EcommercePlatformDataContext(); PaymentType ptype = db.PaymentTypes.Where(x => x.name.ToLower() == type.ToLower()).FirstOrDefault(); Payment p = new Payment { type = ptype.ID, created = DateTime.UtcNow, confirmationKey = confirmKey, status = status }; db.Payments.InsertOnSubmit(p); db.SubmitChanges(); Cart c = db.Carts.Where(x => x.ID == this.ID).FirstOrDefault<Cart>(); c.payment_id = p.ID; db.SubmitChanges(); this._payment_id = p.ID; }
partial void UpdatePayment(Payment instance);
partial void DeletePayment(Payment instance);
partial void InsertPayment(Payment instance);