public JsonResult MemberNewAd(AdViewModel model) { var session = HttpContext.Session; if (session != null) { HttpContext.Session.TryGetValue("token", out var result); if (result != null) { TempData["isLoggedIn"] = HttpContext.Session.GetString("token"); TempData["memberID"] = HttpContext.Session.GetString("memberID"); int memberID = Convert.ToInt32(TempData["memberID"].ToString()); Tbl_Ad ad = model.ad; ad.MemberID = memberID; ad.AdState = "akrif"; _AdService.Add(ad); return(Json(Ok())); //return Json("MemberAdListCrud", "MemberPage"); } } return(Json("Giriş Yapın")); }
public ActionResult MemberNewAd(AdViewModel model) { var session = HttpContext.Session; if (session != null) { HttpContext.Session.TryGetValue("token", out var result); if (result != null) { TempData["isLoggedIn"] = HttpContext.Session.GetString("token"); TempData["memberID"] = HttpContext.Session.GetString("memberID"); int memberID = Convert.ToInt32(TempData["memberID"].ToString()); Tbl_Ad ad = model.ad; ad.MemberID = memberID; ad.AdState = "akrif"; ad.AdDate = DateTime.Now; _AdService.Add(ad); return(RedirectToAction("MemberAdListCrud", "MemberPage")); } } return(RedirectToAction("Index", "GeneralPage")); }