Пример #1
0
 public void UpdateAnswerReview(AnswerReview answerReview)
 {
     using (var _context = new AskUsDbContext())
     {
         _context.Entry(answerReview).State = EntityState.Modified;
         _context.SaveChanges();
     }
 }
Пример #2
0
 public AnswerReview GetAnswerReviewById(int id)
 {
     using (var _context = new AskUsDbContext())
     {
         AnswerReview answerReview = _context.AnswerReviews.Where(x => x.Id == id).FirstOrDefault();
         return(answerReview);
     }
 }
Пример #3
0
 public void AddAnswerReview(AnswerReview answerReview)
 {
     using (var _context = new AskUsDbContext())
     {
         _context.AnswerReviews.Add(answerReview);
         _context.SaveChanges();
     }
 }
Пример #4
0
        public ActionResult Create(AnswerReviewModel Rmodel)
        {
            try
            {
                AnswerReview _answerReview = new AnswerReview();
                _answerReview.IsApproved       = Rmodel.IsApproved;
                _answerReview.IsReviewed       = Rmodel.IsReviewed;
                _answerReview.QuestionAnswerId = Rmodel.QuestionAnswerId;
                _answerReview.Rating           = Rmodel.Rating;
                _answerReview.ReplyText        = Rmodel.ReplyText;
                _answerReview.ReviewText       = Rmodel.ReviewText;
                _answerReview.Title            = Rmodel.Title;
                _answerReview.UserId           = Rmodel.UserId;
                _answerReview.CreatedOnUtc     = DateTime.Now.ToUniversalTime();
                AnswerReviewBAL _answerReviewBAL = new AnswerReviewBAL();
                _answerReviewBAL.AddAnswerReview(_answerReview);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }