public ActionResult SaveWishlistItem(string name, string description, string link) { var accountId = HttpContext.Session.Get <long>(SessionHelper.SessionKeyAccountId); if (accountId == default) { return(RedirectToAction("Login", "Account", new { id = LoginHelper.BudgetApp })); } if (string.IsNullOrWhiteSpace(name)) { return(Json(new { status = false, message = "Name is required." })); } if (string.IsNullOrWhiteSpace(description)) { description = null; } if (string.IsNullOrWhiteSpace(link)) { link = null; } if (WishlistRepository.WishlistItemExists(accountId, name)) { return(Json(new { status = false, message = $"Item already exists with name {name}." })); } WishlistRepository.AddWishlistItem(accountId, name, description, link); return(Json(new { status = true, message = "Wishlist Item Added!" })); }