Example #1
0
        public ActionResult CreateOdznak(KnihovnaOceneni book)
        {
            if (ModelState.IsValid)
            {
                KnihovnaOceneni b = new KnihovnaOceneni()
                {
                    Name         = book.Name,
                    Id           = Books.Counter(),
                    OdznakId     = book.OdznakId,
                    Text         = book.Text,
                    UserId       = book.UserId,
                    DatumZiskani = DateTime.Now,
                    Image        = book.Image,
                    Venovani     = ""
                };

                KnihovnaOceneniArchetypDao a = new KnihovnaOceneniArchetypDao();
                KnihovnaOceneniArchetyp    o = a.GetbyId(b.OdznakId);

                b.Image = o.Image;


                KnihovnaOceneniDao bookDao = new KnihovnaOceneniDao();
                bookDao.Create(b);

                // Notifikace
                TempData["scs"] = "V pořádku";
            }
            else
            {
                return(View("AddOdznak", book)); // Vrátím vstupní data
            }

            return(Redirect(Request.UrlReferrer.ToString()));
        }
Example #2
0
        public ActionResult AddOdznak()
        {
            KnihovnaOceneni o = new KnihovnaOceneni();

            ViewBag.DruhyOdznaku = new KnihovnaOceneniArchetypDao().GetAll();

            return(View(o));
        }
Example #3
0
        public ActionResult Test(int id)
        {
            KnihovnaOceneniDao d = new KnihovnaOceneniDao();
            KnihovnaOceneni    o = d.GetbyId(id);



            ViewBag.Id   = id;
            ViewBag.Text = o.Text;

            return(PartialView());
        }