Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [Route("users/{userid}/create")]
- public ActionResult CreateSellerProfile(string userId)
- {
- var country = _locationService.GetCountries().ToDictionary(x => x.Id, x => x.CountryName);
- var model = new SellerProfileViewModel { CountryDic = country };
- model.UserId = userId;
- return View(model);
- }
- [Authorize]
- [HttpPost]
- [Route("users/create")]
- public ActionResult CreateSellerProfile(SellerProfileViewModel model)
- {
- if (!ModelState.IsValid)
- {
- model.StateDic = _locationService.Getstates(model.CountryId).ToDictionary(x => x.Id, x => x.StateName);
- model.CountryDic = _locationService.GetCountries().ToDictionary(x => x.Id, x => x.CountryName);
- return View(model);
- }
- var checkForalreadyExists = _userService.GetSellerProfileByUserId(model.UserId);
- if (checkForalreadyExists == null)
- {
- var domainSellerObj = Mapper.Map<SellerProfileViewModel, SellerProfile>(model);
- _userService.SaveSellerProfile(domainSellerObj);
- return RedirectToAction("CreateSellerProfile", new { model.UserId });
- }
- else
- {
- SetMessage(MessageType.Danger, MessageConstant.GetMessage(Messages.SellerProfileAdded));
- return RedirectToAction("CreateSellerProfile", new { model.UserId });
- }
- }
- //I want to ask that after we do POST to this action CreateSellerProfile,
- //then we want to redirect again to the same action CreateSellerProfile empty page,
- //we are facing the problem that it's not able to find the route that we defined i.e [Route("users/{userid}/create")]
Add Comment
Please, Sign In to add comment