Пример #1
0
        public ActionResult Add(string description, int topicId, int reply, string type = "", string typeData = "", string sumText = "")
        {
            if (type != "create" && type != "")
            {
                if (typeData == "komentEdit")
                {
                    Edit(int.Parse(type), description);
                }
                else
                {
                    EditPrispevek(topicId, description, sumText);
                }
            }
            else
            {
                KnihovnaKomentareDao knihovnaKomentareDao = new KnihovnaKomentareDao();
                KnihovnaKomentare    komentar             = new KnihovnaKomentare();

                komentar.Id      = Books.Counter();
                komentar.Content = description;
                komentar.OwnerId = new KnihovnaUserDao().GetByLogin(User.Identity.Name);
                komentar.Date    = DateTime.Now;
                komentar.TopicId = topicId;
                komentar.ReplyId = reply;

                knihovnaKomentareDao.Create(komentar);

                KnihovnaUserDao dao  = new KnihovnaUserDao();
                KnihovnaUser    user = dao.GetByLogin(User.Identity.Name);

                UserStats.NewComment(dao, user);

                NovinkyGenerator.PridatNovinku(komentar, user.Id);
            }

            return(Redirect(this.Request.UrlReferrer.AbsolutePath));
        }