public async Task <IActionResult> PutDQuestion(int id, DQuestion dQuestion)
        {
            dQuestion.id = id;

            _context.Entry(dQuestion).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DQuestionExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
예제 #2
0
        public async Task <UserChoice> AddUserChoice(UserChoice userChoice)
        {
            try
            {
                var result = _context.UserChoices.AddAsync(userChoice);
                await _context.SaveChangesAsync();

                return(userChoice);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.InnerException.Message);
                return(null);
            }
        }
예제 #3
0
 public async Task SaveAsync()
 {
     await _context.SaveChangesAsync();
 }