public async Task <IActionResult> AddUserAddress(AddUserAddressViewModel model) { var l = _dictionarySerce.GetDictionaryObjectList("Voivodeships"); model.Voivodeships = l; if (ModelState.IsValid) { Address address = new Address { City = model.City, HouseNr = model.HouseNr, LocalNr = model.LocalNr, Phone = model.Phone, PostCode = model.PostCode, Street = model.Street, Voivodeship = model.Voivodeship }; var currentUser = await _userManager.GetUserAsync(User); var result = await _addressService.AddAddressAsync(address, currentUser.Id); if (result) { ViewBag.Message = "Dodano adres"; return(View(model)); } } return(View(model)); }
public IActionResult AddUserAddress() { var l = _dictionarySerce.GetDictionariesObject(1).Select(x => new SelectListItem { Value = x.DictionaryObjectName, Text = x.DictionaryObjectName }); var vm = new AddUserAddressViewModel() { Voivodeships = l }; return(View(vm)); }