public ActionResult AddTicket(string titre, string description, string urlPhoto, IEnumerable <TagModel> tags) { using (IMethods methods = new MethodFromContext()) { try { using (var context = new ContexteBdd()) { UtilisateurModel utilisateur = methods.GetUtilisateur((int)Session["user"]); DateTime dateNow = DateTime.Now; methods.CreerTicket(titre, description, utilisateur, dateNow, urlPhoto, tags); ViewBag.titre = titre; ViewBag.description = description; ViewBag.utilisateur = utilisateur; ViewBag.date = dateNow; } return(View("~/Views/Home/GetAllTickets.cshtml")); } catch (IOException e) { Console.WriteLine($"Error : '{e}'"); } return(View("~/Views/Home/AddTicket.cshtml")); } }
public ActionResult ListTickets() { using (IMethods methods = new MethodFromContext()) { try { List <TicketModel> tickets = methods.GetAllTickets(); ViewBag.tickets = tickets; UtilisateurModel utilisateur = methods.GetUtilisateur((int)Session["user"]); ViewBag.Utilisateur = utilisateur; ClasseModel classe = utilisateur.classe; ViewBag.Classe = classe; return(View("~/Views/Home/ListerPost.cshtml", tickets)); } catch (IOException e) { Console.WriteLine($"Error : '{e}'"); return(View("~/Views/Home/ListerPost.cshtml")); } } }