public IActionResult Create(CreateDeliveryAddressViewModel vm) { ApplicationUser user = GetCurrentUserAsync().Result; Profile profile = _profileRepo.GetSingle(p => p.UserId == user.Id); DeliveryAddress address = new DeliveryAddress() { Name = vm.DeliveryAddress.Name, StreetAddress = vm.DeliveryAddress.StreetAddress, City = vm.DeliveryAddress.City, State = vm.DeliveryAddress.State, Postcode = vm.DeliveryAddress.Postcode, ProfileId = profile.ProfileId, Active = true }; _addressRepo.Create(address); return(RedirectToAction("Index")); }
public ActionResult CreateAddress(CreateDeliveryAddressViewModel model) { if (!this.ModelState.IsValid) { return this.View(model); } var userId = this.User.Identity.GetUserId(); int id = this.delliveryAddressesService.Create(userId, model.Country, model.City, model.Street, model.PostCode, model.Email, model.Phone); return this.RedirectToAction(x => x.ConfirmOrder(id)); }