public IActionResult GenerationShortUrlSuccess() { Link newAd = SerializingTools.Get <Link>(TempData, "newAd"); if (newAd != null) { return(View(newAd)); } return(RedirectToAction("Index")); }
public IActionResult GenerateShortUrl(Link newAd) { if (ModelState.IsValid) { //dodanie użytkownika, który tworzy link (null w przypadku braku) var user = _userManager.GetUserAsync(User); newAd.AdOwner = user.Result; try { _adRepository.Add(newAd); } catch (Exception exception) { return(RedirectToAction("GenerationShortUrlFailure")); } SerializingTools.Put <Link>(TempData, "newAd", newAd); return(RedirectToAction("GenerationShortUrlSuccess")); } return(View(newAd)); }