public ActionResult Daka(Biji biji) { if (ModelState.IsValid) { unitOfWork.bijisRepository.Insert(biji); unitOfWork.Save(); return(RedirectToAction("Ucenter", "Ucenter")); } Ying ying = unitOfWork.yingsRepository.GetByID(biji.Dushuying); ViewData["dakaying"] = ying; return(View(biji)); }
public ActionResult DakaContent(int bid) { if (Session["uid"].ToString() != "" && Session["uid"] != null) { int uid = int.Parse(Session["uid"].ToString()); Ren ren = unitOfWork.rensRepository.GetByID(uid); ViewData["user"] = ren; Biji biji = unitOfWork.bijisRepository.GetByID(bid); var dianzan = unitOfWork.bijiDianzansRepository.Get(filter: u => u.DianzanBiji == bid && u.Dianzanren == ren.Id && u.Dianzan == true); ViewBag.dianzan = false; if (dianzan.Count() > 0) { ViewBag.dianzan = true; } return(View(biji)); } else { return(RedirectToAction("Login", "Account")); } }
public ActionResult BijiContent(int bid) { Biji biji = unitOfWork.bijisRepository.GetByID(bid); var Pingluns = unitOfWork.bijiPinglunsRepository.Get(filter: u => u.PinglunBiji == bid, orderBy: q => q.OrderByDescending(u => u.Id)); ViewData["Pingluns"] = Pingluns; ViewBag.dianzan = false; if (Session["uid"] == null) { ViewBag.dianzan = false; } else { int dianzanren = int.Parse(Session["uid"].ToString()); var dianzan = unitOfWork.bijiDianzansRepository.Get(filter: u => u.DianzanBiji == bid && u.Dianzanren == dianzanren && u.Dianzan == true); ViewBag.dianzan = false; if (dianzan.Count() > 0) { ViewBag.dianzan = true; } } return(View(biji)); }