public async Task <ActionResult <IEnumerable <JobQuestion> > > Questions(JobQuestion Question)
        {
            _context.JobQuestion.Add(Question);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetJobOrder", new { id = Question.Id }, Question));
        }
        public async Task <ActionResult <JobQuestion> > Questions(int id, JobQuestion Question)
        {
            if (id != Question.Id)
            {
                return(BadRequest());
            }
            _context.Entry(Question).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!JobQuestionExists(id))
                {
                    return(Ok(new { StatusCode = StatusCodes.Status200OK, Message = "No Record Found." }));
                }
                else
                {
                    throw;
                }
            }

            return(Ok(new { StatusCode = StatusCodes.Status200OK, result = Question }));
        }
示例#3
0
        public async Task <ActionResult <JobQuestion> > PostJobQuestions(JobQuestion JobQuestions)
        {
            _context.JobQuestion.Add(JobQuestions);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetJobQuestions", new { id = JobQuestions.Id }, JobQuestions));
        }