public tbl_BillingAddress GetBAddress(tbl_BillingAddress address)
 {
     using (var context = new console.Models.dream_techContext())
     {
         return((from t in context.tbl_BillingAddress where t.billing_id == address.billing_id select t).SingleOrDefault());
     }
 }
示例#2
0
        public tbl_BillingAddress CreateBAddress(RegisterViewModel model)
        {
            var billingrepo = new Repos.BillingAddressRepo();
            var newBAddress = new tbl_BillingAddress();

            newBAddress.address_line = model.AddressLine;
            newBAddress.suburb       = model.Suburb;
            newBAddress.city         = model.City;
            newBAddress.postal_code  = Convert.ToInt32(model.PostalCode);
            newBAddress.country_id   = Convert.ToInt32(model.Country);

            billingrepo.SaveBAddress(newBAddress);

            return(newBAddress);
        }
        public bool UpdateBAddress(console.Models.tbl_BillingAddress entity)
        {
            bool result = false;

            using (var context = new console.Models.dream_techContext())
            {
                tbl_BillingAddress address = (from b in context.tbl_BillingAddress where b.billing_id == entity.billing_id select b).First();

                address.address_line = entity.address_line;
                address.suburb       = entity.suburb;
                address.city         = entity.city;
                address.postal_code  = entity.postal_code;
                address.country_id   = entity.country_id;

                result = context.SaveChanges() > 1;
            }
            return(result);
        }
示例#4
0
        public tbl_User CreateUser(RegisterViewModel model, tbl_CustomerContact contact, tbl_BillingAddress billing, tbl_DelivetyAddresses delivery)
        {
            var userRepo = new Repos.UserRepo();
            var newUser  = new tbl_User();

            newUser.user_name     = model.Name;
            newUser.user_surname  = model.Surname;
            newUser.email_address = model.Email;
            newUser.password      = model.Password;
            newUser.delivery_id   = delivery.delivery_id;
            newUser.billing_id    = billing.billing_id;
            newUser.contact_id    = contact.contact_id;

            userRepo.SaveUser(newUser);

            return(newUser);
        }