public IActionResult AddNewAddress(AddressForCreationVm address) { if (address.Btn == "Submit") { _addressService.AddNewAddress(address); } return(RedirectToAction("CustomerView", "Customer", new { customerId = address.CustomerId })); }
public IActionResult AddAddress(NewAddressVm model) { if (!ModelState.IsValid) { model.AddressTypes = _addresService.GetAddressTypes(); model.VoivodeshipsVm = _addresService.GetAllVoivedoships(); model.AddressTypes = _addresService.GetAddressTypes(); model.ApplicationUserID = _userManager.GetUserId(User); return(View(model)); } model.AddressTypes = _addresService.GetAddressTypes(); model.VoivodeshipsVm = _addresService.GetAllVoivedoships(); model.AddressTypes = _addresService.GetAddressTypes(); model.ApplicationUserID = _userManager.GetUserId(User); _addresService.AddNewAddress(model); TempData["succesMessage"] = "Pomyślnie dodano nowy adres!"; return(RedirectToAction("UserAddresses", "User")); }
public async Task AddNewAddress([FromBody] Address address) { await _addressService.AddNewAddress(address); }