public ActionResult Details(BlogPost entite)
        {
            ViewBag.Tags = _tagsRepo.GetTags();
            string nomUsager = Session["LoggedUser"] as string;
            User   usager    = _usersRepo.GetByUserName(nomUsager);

            entite.UserId = usager.UserId;
            if (!ModelState.IsValid)
            {
                return(View(entite));
            }

            TryUpdateModel(entite);
            var tags = Request["Tags"] != null ?
                       Request["Tags"].Split(new[] { "," }, System.StringSplitOptions.RemoveEmptyEntries) :
                       new List <string>().ToArray();
            int resultat;

            if (entite.Id == 0)
            {
                entite.CreateTime = DateTime.Now;
                resultat          = _bloguesRepo.AddBlog(entite, tags);
            }
            else
            {
                resultat = _bloguesRepo.UpdateBlog(entite, tags);
            }

            if (resultat != 0)
            {
                return(RedirectToAction("Index"));
            }
            ModelState.AddModelError(string.Empty, "oops! veuillez réessayer de nouveau!");
            return(View(entite));
        }