public ActionResult Details(string UzytkownikId, int IdOgloszenia, string tresc)
        {
            OgloszenieDetailsViewModel ogloszenie = _repo.GetOgloszeniaById((int)IdOgloszenia);

            if (ModelState.IsValid)
            {
                try
                {
                    string userId = User.Identity.GetUserId();
                    _messageRepo.SendMessage(userId, IdOgloszenia, tresc);
                    _messageRepo.SaveChanges();
                }
                catch (Exception)
                {
                    ViewBag.Blad = true;
                    return(View(ogloszenie));
                }
            }
            else if (tresc != "")
            {
                ViewBag.Blad = true;
                return(View(ogloszenie));
            }

            ViewBag.Blad = false;
            return(View(ogloszenie));
        }
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            OgloszenieDetailsViewModel ogloszenie = _oglRepo.GetOgloszeniaById((int)id);

            if (ogloszenie == null)
            {
                return(HttpNotFound());
            }
            return(View(ogloszenie));
        }
        public ActionResult Delete(int?id, bool?blad)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            OgloszenieDetailsViewModel ogloszenie = _repo.GetOgloszeniaById((int)id);

            if (ogloszenie == null)
            {
                return(HttpNotFound());
            }
            else if (ogloszenie.UzytkownikId != User.Identity.GetUserId() && !User.IsInRole("Admin"))
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            if (blad != null)
            {
                ViewBag.Blad = true;
            }
            return(View(ogloszenie));
        }