Пример #1
0
        public ActionResult LaisserUnAvis(string nSeo)
        {
            Formation formation;

            using (var context = new AvisEntities())
            {
                formation = context.Formations.FirstOrDefault(f => f.NomSeo == nSeo);

                if (formation == null)
                {
                    RedirectToAction("ToutesLesFormations", "Formations");
                }
            }
            AvisManager la      = new AvisManager();
            var         user_id = User.Identity.GetUserId();

            if (!la.IsLimiterLesAvis(user_id, formation.Id))
            {
                LaisserUnAvisViewModel vm = new LaisserUnAvisViewModel();
                vm.formationNseo = nSeo;
                vm.formationName = formation.Nom;
                return(View(vm));
            }


            return(RedirectToAction("DetailsFormation", "Formations", new { nSeo = nSeo }));
        }
Пример #2
0
        public ActionResult SaveComment(string note, string description, string nSeo)
        {
            string      user_id         = User.Identity.GetUserId();
            AvisManager avisInformation = new AvisManager();

            avisInformation.AjouterUnAvis(user_id, description, note, nSeo);


            // RedirectToAction("DetailsFormation", "Formations",new { nSeo=nSeo});


            return(RedirectToAction("DetailsFormation", "Formations", new { nSeo = nSeo }));
            //  return RedirectToRoute("DetailsFormation");
        }