public int CreatePaymentMethod(RegisterViewModel model, string userID) { var payMethod = new PaymentMethod(); using (var temp = new skAmazonEntities()) { payMethod.PaymentDescription = model.PaymentDescription; payMethod.DateCreated = System.DateTime.Now; payMethod.PaymentType = model.PaymentType; payMethod.BillingAddressID = model.AddressID; payMethod.UserID = userID; payMethod.CardNumber = model.CardNumber; payMethod.ExpirationDate = model.ExpirationDate; payMethod.SecurityCode = model.SecurityCode; temp.PaymentMethods.Add(payMethod); temp.SaveChanges(); } return(payMethod.PaymentMethodID); }
public int CreateCustomerAddress(RegisterViewModel model, string userID) { var address = new CustomerAddress(); using (var temp = new skAmazonEntities()) { address.AddrLine1 = model.AddrLine1; address.AddrLine2 = (model.AddrLine2 == null)? "" : model.AddrLine2; address.City = model.City; address.State = model.State; address.ZIP = model.ZIP; address.Country = model.Country; address.DateCreated = System.DateTime.Now; address.UserId = userID; temp.CustomerAddresses.Add(address); temp.SaveChanges(); } return(address.AddressID); }