/// <summary>
        /// Finds the answersheet by id
        /// </summary>
        /// <param name="context"></param>
        public async Task <IActionResult> PutAnswerSheet(long id, AnswerSheet answerSheet)
        {
            if (id != answerSheet.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("Id,Test_Name")] Test test)
        {
            if (ModelState.IsValid)
            {
                _context.Add(test);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(test));
        }