Esempio n. 1
0
        public ActionResult CommentToFeedBack(long Id)
        {
            var feedBack = DB.AccountFeedBack.Single(x => x.Id == Id);
            var model    = new FeedBackComment()
            {
                Id          = Id,
                Status      = feedBack.Status,
                Description = feedBack.Description
            };

            model.StatusList  = EnumHelper.GetSelectList(typeof(FeedBackStatus), (FeedBackStatus)model.Status).ToList();
            model.CommentList = DB.AccountFeedBackComment.Where(x => x.IdFeedBack == Id).OrderByDescending(x => x.DateAdd).ToList();
            return(View(model));
        }
Esempio n. 2
0
        public ActionResult CommentToFeedBack(FeedBackComment model)
        {
            var feedBack = DB.AccountFeedBack.Single(x => x.Id == model.Id);

            feedBack.AdminId  = CurrentUser.Id;
            feedBack.DateEdit = DateTime.Now;
            feedBack.Status   = model.Status;

            // если передан текст комментария
            if (!string.IsNullOrEmpty(model.Comment))
            {
                var comment = new AccountFeedBackComment()
                {
                    AdminId = CurrentUser.Id,
                    DateAdd = DateTime.Now,
                    Comment = model.Comment
                };
                feedBack.AccountFeedBackComment.Add(comment);
            }
            DB.SaveChanges();
            return(RedirectToAction("Index"));
        }