public void UpdateAnswerReview(AnswerReview answerReview) { using (var _context = new AskUsDbContext()) { _context.Entry(answerReview).State = EntityState.Modified; _context.SaveChanges(); } }
public AnswerReview GetAnswerReviewById(int id) { using (var _context = new AskUsDbContext()) { AnswerReview answerReview = _context.AnswerReviews.Where(x => x.Id == id).FirstOrDefault(); return(answerReview); } }
public void AddAnswerReview(AnswerReview answerReview) { using (var _context = new AskUsDbContext()) { _context.AnswerReviews.Add(answerReview); _context.SaveChanges(); } }
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()); } }