Beispiel #1
0
        public IActionResult SetAsBest(int ResponseId, int QuestionId)
        {
            var thisQuestion = _db.Questions.FirstOrDefault(x => x.Id == QuestionId);

            thisQuestion.BestResponseId   = ResponseId;
            _db.Entry(thisQuestion).State = EntityState.Modified;
            _db.SaveChanges();

            return(RedirectToAction("Details", new { QuestionId = QuestionId }));
        }
        public IActionResult VoteResponse(int ResponseId, int QuestionId, int vote)
        {
            var thisResponse = _db.Responses.FirstOrDefault(response => response.Id == ResponseId);

            thisResponse.VoteCount       += vote;
            _db.Entry(thisResponse).State = EntityState.Modified;
            _db.SaveChanges();

            return(RedirectToAction("Details", "Question", new { QuestionId = QuestionId }));
        }
 public void Update(Category model)
 {
     _dbContext.Entry(model).State = EntityState.Modified;
     Save();
 }
Beispiel #4
0
 public void Update(Discussion model)
 {
     _dbContext.Entry(model).State = EntityState.Modified;
     Save();
 }
 public void Update(VoteType model)
 {
     _dbContext.Entry(model).State = EntityState.Modified;
     Save();
 }