Пример #1
0
 public bool Equals(Vote obj)
 {
     if (obj == null)
         return false;
     return string.Equals(TeacherId, obj.TeacherId, StringComparison.OrdinalIgnoreCase)
         && string.Equals(AccountId, obj.AccountId, StringComparison.OrdinalIgnoreCase)
         && Answer == obj.Answer
         && obj.QuestionId.Id.Equals(QuestionId.Id, StringComparison.OrdinalIgnoreCase);
 }
Пример #2
0
        public async Task<JsonResult> AddAnswer(string id, string questionId, short answer)
        {
            var vote = new Vote()
            {
                TeacherId = id,
                Answer = answer,
                AccountId = User.Identity.GetGroupId()
            };
            var result = await Site.VoteManager.Save(vote, questionId);
            if (result)
                return Json(true);

            return Json(false, 505);
        }