public ActionResult DetailDeveloper(int id)
        {
            GameDao gameDao = new GameDao();
            Game    g       = gameDao.GetById(id);

            return(View(g));
        }
Example #2
0
        public ActionResult addPolozku(int idhra, int idobjednavka)
        {
            PolozkaObjednavkaDao polozkaObjednavkaDao = new PolozkaObjednavkaDao();
            PolozkaObjednavka    polozka = new PolozkaObjednavka();
            GameDao gameDao = new GameDao();
            Hra     hra     = gameDao.GetById(idhra);

            polozka.Hra          = hra;
            polozka.Mnozstvi     = 1;
            polozka.ObjednavkaID = idobjednavka;
            polozka.TehdejsiCena = hra.aktualniCenasDPH();
            polozka.Stav         = new StavDao().GetById(8);
            polozka.Aktivovano   = true;
            ObjednavkaDao objednavkaDao = new ObjednavkaDao();
            Objednavka    objednavka    = objednavkaDao.GetById(idobjednavka);

            polozkaObjednavkaDao.Create(polozka);


            objednavka.Polozky = polozkaObjednavkaDao.getbyObjednavka(objednavka.Id);
            objednavka.prepocet();

            objednavkaDao.Update(objednavka);
            return(RedirectToAction("DetailObjednavky", new { id = objednavka.Id }));
            //return Redirect(ControllerContext.HttpContext.Request.UrlReferrer.ToString());
        }
Example #3
0
        [HttpPost] //aby nikdo nemohl to udělat přes url
        public ActionResult delete(String _id, int?_page, int?_itemsOnPage, bool?vse)
        {
            int     id      = int.Parse(_id);
            GameDao gameDao = new GameDao();
            Hra     hra     = gameDao.GetById(id);

            if (hra.Ikona != null)
            {
                try
                {
                    System.IO.File.SetAttributes(Server.MapPath("~/uploads/hry/" + hra.Ikona), FileAttributes.Normal);
                    System.IO.File.Delete(Server.MapPath("~/uploads/hry/" + hra.Ikona));
                }
                catch (Exception e)
                {
                }
            }

            PlatformaDao platformaDao = new PlatformaDao();

            VydavatelDao vydavateleDao = new VydavatelDao();

            TempData["message-success"] = "Hra " + hra.Nazev + "byla upravena.";
            Vydavatel vydavatel = hra.Vydavatel;
            Platforma platforma = hra.Platforma;

            platforma.Pocet--;
            vydavatel.Pocet--;
            platformaDao.Update(platforma);
            vydavateleDao.Update(vydavatel);
            gameDao.Delete(hra);
            return(RedirectToAction("Hra"));
        }
Example #4
0
        public ActionResult Video(int id)
        {
            GameDao gameDao = new GameDao();
            Game    g       = gameDao.GetById(id);

            return(View(g));
        }
Example #5
0
        public ActionResult AddObrazek(Obrazek obrazek, string hra, HttpPostedFileBase obr)
        {
            GameDao gameDao = new GameDao();
            Hra     hra1    = gameDao.GetById(int.Parse(hra));

            obrazek.Game = hra1;

            if (obr != null)
            {
                if (obr.ContentType == "image/jpeg" || obr.ContentType == "image/png")

                {
                    Image image = Image.FromStream(obr.InputStream);
                    if (image.Height > 200 || image.Width > 200)
                    {
                        Image smallImage = ImageHelper.ScaleImage(image, 1080, 960);

                        Bitmap b         = new Bitmap(smallImage);
                        Guid   guid      = Guid.NewGuid();
                        string imageName = guid.ToString() + ".jpg";
                        b.Save(Server.MapPath("~/uploads/hry/" + imageName), ImageFormat.Jpeg);
                        smallImage.Dispose();
                        b.Dispose();
                        if (obrazek.Ikona != null)
                        {
                            try
                            {
                                System.IO.File.SetAttributes(Server.MapPath("~/uploads/hry/" + obrazek.Ikona), FileAttributes.Normal);
                                System.IO.File.Delete(Server.MapPath("~/uploads/hry/" + obrazek.Ikona));
                            }
                            catch (Exception e)
                            {
                            }
                        }

                        obrazek.Ikona = imageName;
                    }
                    else
                    {
                        obrazek.Ikona = Server.MapPath("~´/uploads/hry/" + obr.FileName);
                        obr.SaveAs(Server.MapPath("~´/uploads/hry/" + obr.FileName));
                    }
                    ObrazekDao obrazekDao = new ObrazekDao();
                    obrazekDao.Create(obrazek);
                    TempData["message-success"] = "Přidán obrázek";

                    return(RedirectToAction("DetailHry", new{ id = obrazek.Game.Id }));
                }
                else
                {
                    TempData["err"] = "Chybí obrázek, nebo není typu JPG / PNG";
                    return(View("pridatObrazek", obrazek));
                }
            }


            TempData["err"] = "Něco se pokazilo";
            return(View("pridatObrazek", obrazek));
        }
Example #6
0
        public ActionResult pridatObrazek(int id_hry)
        {
            GameDao gameDao = new GameDao();
            Hra     hra     = gameDao.GetById(id_hry);
            Obrazek novy    = new Obrazek();

            novy.Game       = hra;
            novy.Aktivovano = true;

            return(View(novy));
        }
Example #7
0
        public ActionResult Edit(int id)
        {
            GameDao         gameDao         = new GameDao();
            GameCategoryDao gameCategoryDao = new GameCategoryDao();

            Game g = gameDao.GetById(id);

            ViewBag.Categories = gameCategoryDao.GetAll();

            return(View(g));
        }
Example #8
0
        public ActionResult DetailDeveloper(int id)
        {
            GameDao gameDao = new GameDao();
            Game    g       = gameDao.GetById(id);

            if (Request.IsAjaxRequest())
            {
                return(PartialView(g));
            }

            return(View(g));
        }
Example #9
0
        [HttpPost] //aby nikdo nemohl to udělat přes url
        public ActionResult EditHra(int _id)
        {
            GameDao           gameDao      = new GameDao();
            Hra               hra          = gameDao.GetById(_id);
            PlatformaDao      platformaDao = new PlatformaDao();
            IList <Platforma> platformy    = platformaDao.GetlAll();

            VydavatelDao      vydavateleDao = new VydavatelDao();
            IList <Vydavatel> vydavatele    = vydavateleDao.GetlAll();

            platformy.Insert(0, hra.Platforma);
            vydavatele.Insert(0, hra.Vydavatel);
            ViewBag.platformy  = platformy;
            ViewBag.vydavatele = vydavatele;

            return(View(hra));
        }
Example #10
0
        public ActionResult Delete(int id)
        {
            try
            {
                GameDao gameDao = new GameDao();
                Game    game    = gameDao.GetById(id);


                gameDao.Delete(game);

                TempData["message-success"] = "Hra " + game.Name + " byla smazána";
            }
            catch (Exception exception)
            {
                throw;
            }

            return(RedirectToAction("Index"));
        }
Example #11
0
        public ActionResult aktivace2(String _id)
        {
            int     id      = int.Parse(_id);
            GameDao gameDao = new GameDao();
            Hra     hra     = gameDao.GetById(id);

            if (hra.Aktivovano)
            {
                hra.Aktivovano = false;
            }
            else
            {
                hra.Aktivovano = true;
            }


            gameDao.Update(hra);
            // return RedirectToAction("Hra", new { _page = _page, vse = vse, _itemsOnPage = _itemsOnPage });
            return(RedirectToAction("DetailHry", new { id = hra.Id }));
        }