Example #1
0
 [HttpPost]                                                                 ///Aetladi ad reyna hengja Shipping ID a User. Nytt migration og tafla var ekki ad virka, tharf ad halda i gomlu.!--
 public IActionResult RegisterShipping(ShippingAddressInputModel newAddres) ///ApplicationUser Email
 {
     if (ModelState.IsValid)
     {
         int count = _userRepo.GetAllUsers().Count();
         SeedData(newAddres);                ///ApplicationUser Email
         return(RedirectToAction("MyProfileView"));
     }
     return(View("RegisterShipping"));
 }
Example #2
0
        public static void SeedData(ShippingAddressInputModel newAddres) ///ApplicationUser Email
        {
            var user_db = new DataContext();

            var shipping_db = new DataContext();
            var shipping    = new List <ShippingAddress>
            {
                new ShippingAddress
                {
                    Address     = newAddres.Address,
                    City        = newAddres.City,
                    HouseNumber = newAddres.HouseNumber,
                    Country     = newAddres.Country,
                    PostalCode  = newAddres.PostalCode,
                    //  UserID = Email,
                }
            };

            shipping_db.AddRange(shipping);

            shipping_db.SaveChanges();
        }