public PartialViewResult CreateWithNewAddress( NewAddressInput model )
        {
            if ( ModelState.IsValid )
            {
                Address Address = new Address( model.Address.Nick, model.Address.Line1, model.Address.Line2, model.Address.City, db.States.Find( model.Address.StateID ), model.Address.ZIP );
                PaymentMethod PaymentMethod = new PaymentMethod
                (
                    model.CardHolderName,
                    db.CardTypes.Find(model.CardTypeID),
                    model.CardNumber,
                    new DateTime( model.Year, model.Month, 1 ),
                    model.CCV,
                    Address
                );
                Account.PaymentMethods.Add( PaymentMethod );
                try
                {
                    db.SaveChanges();
                    Account.Addresses.Add( Address );
                    db.SaveChanges();
                }
                catch (Exception ex)
                {

                }
                return PartialView( "_PaymentMethods", Account.PaymentMethods );
            }
            return PartialView();
        }
Ejemplo n.º 2
0
 public Restaurant( Chain Chain, Address Address )
     : base()
 {
     this.Chain = Chain;
     this.Address = Address;
     this.Representatives = new Collection<Representative>();
 }
Ejemplo n.º 3
0
 public PaymentMethod(String CardHolderName, CardType CardType, String CardNumber, DateTime Expiration, String CCV, Address BillingAddress)
     : base()
 {
     this.CardHolderName = CardHolderName;
     this.CardType = CardType;
     this.CardNumber = CardNumber;
     this.Expiration = Expiration;
     this.CCV = CCV;
     this.BillingAddress = BillingAddress;
     //this.DeriveCardType();
     this.VerifyExpiration();
 }
Ejemplo n.º 4
0
 public PartialViewResult CreateConfirmed( AddressInput model )
 {
     if ( ModelState.IsValid )
     {
         Address Address = new Address( model.Nick, model.Line1, model.Line2, model.City, db.States.Find( model.StateID ), model.ZIP );
         Account.Addresses.Add( Address );
         db.SaveChanges();
         ViewBag.Refresh = new string[] {"Addresses"};
         return PartialView("_Empty");
         //return PartialView( "_Addresses", Account.Addresses );
     }
     else
     {
         ModelState.AddModelError( "CreateAddressFailure", "There were errors with the Address." );
         Response.StatusCode = 400;
         Response.StatusDescription = "<h4>There were errors:</h4><p>One or more of the fields could not be saved. Please review the form and ensure everything is valid.</p>";
         return PartialView( "_Addresses", Account.Addresses );
     }
 }