// GET: KinderGarten/Details/5 public ActionResult Details(int?id) { bool test = HasVoted(id); ViewBag.test = test; int userId; try { userId = (int)Session["idu"]; } catch { return(RedirectToAction("Login", "Login")); } String Phone2 = userService.GetById(userId).login; String mail = userService.GetById(userId).email; ViewBag.home = mail; ViewBag.phone = Phone2; if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } KinderGarten k; k = KindergartenService.GetById((int)id); if (k == null) { return(HttpNotFound()); } KinderGartenModel ks = new KinderGartenModel() { Address = k.Address, Cost = k.Cost, DateCreation = k.DateCreation, Description = k.Description, KinderGartenId = k.KinderGartenId, Image = k.Image, Name = k.Name, NbrEmp = k.NbrEmp, Phone = k.Phone, DirecteurId = (int)k.DirecteurId, nbVue = k.nbVue, nameDir = userService.GetById((int)k.DirecteurId).email, Votes = k.Votes }; KindergartenService.IncNbVue(id); return(View(ks)); }
// GET: KinderGarten/Details/5 public ActionResult Details(int?id) { var userId = (int)Session["idu"]; String Phone2 = userService.GetById(userId).login; String mail = userService.GetById(userId).email; ViewBag.home = mail; ViewBag.phone = Phone2; if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } KinderGarten k; k = KindergartenService.GetById((int)id); if (k == null) { return(HttpNotFound()); } KinderGartenModel ks = new KinderGartenModel() { Address = k.Address, Cost = k.Cost, DateCreation = k.DateCreation, Description = k.Description, KinderGartenId = k.KinderGartenId, Image = k.Image, Name = k.Name, NbrEmp = k.NbrEmp, Phone = k.Phone, DirecteurId = (int)k.DirecteurId, nameDir = userService.GetById((int)k.DirecteurId).email }; return(View(ks)); }
public KinderGarten Get(int id) { KinderGarten Kinder = MyService.GetById(id); return(Kinder); }