Advertisement
Guest User

Untitled

a guest
Dec 4th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading.Tasks;
  5. using Microsoft.AspNetCore.Mvc;
  6. using HackFest.Models;
  7.  
  8. namespace HackFest.Controllers
  9. {
  10. public sealed class HomeController : Controller
  11. {
  12. #region Interfaces
  13. private IDepot idepot;
  14. #endregion
  15.  
  16. #region Constructeur
  17. public HomeController(IDepot p_depot) => this.idepot = p_depot;
  18.  
  19. #endregion
  20.  
  21. public ViewResult Index()
  22. {
  23. return View();
  24. }
  25.  
  26. [HttpGet]
  27. public ViewResult Inscriptions()
  28. {
  29. return View();
  30. }
  31. [HttpGet]
  32. public ViewResult InscriptionsCO()
  33. {
  34. return View();
  35. }
  36. [HttpGet]
  37. public ViewResult Panel()
  38. {
  39. return View("Panel");
  40. }
  41. [HttpPost]
  42. public ViewResult Inscriptions(Participant participant)
  43. {
  44. if (ModelState.IsValid)
  45. {
  46. idepot.AjouterParticipants(participant);
  47. return View("MerciInscription", participant);
  48. }
  49. else
  50. return View();
  51. }
  52. [HttpPost]
  53. public ViewResult InscriptionsCO(Organisateur organisateur)
  54. {
  55. if (ModelState.IsValid)
  56. {
  57. idepot.AjouterOrganisateur(organisateur);
  58. return View("MerciInscription", organisateur);
  59. }
  60. else
  61. return View();
  62. }
  63.  
  64. //Debut des posts
  65. [HttpPost]
  66. public ViewResult Index(Connexion p_connexion)
  67. {
  68.  
  69. if (ModelState.IsValid)
  70. {
  71. #region Connexion
  72. string sNom ="";
  73. Depot depot = new Depot();
  74.  
  75. //Requete LINQ qui verifie dans la liste de gens interne s'ils existent.
  76. var req = from d in depot.utilisateursPublic
  77. where d.User == p_connexion.User && d.Password == p_connexion.Password
  78. select d.User;
  79.  
  80. foreach (var x in req)
  81. sNom += x;
  82.  
  83. if (sNom == p_connexion.User.ToString())
  84. return View("Panel", p_connexion);
  85. else
  86. return View();
  87. #endregion
  88. }
  89. else
  90. {
  91. return View();
  92. }
  93. }
  94. }
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement