public IHttpActionResult PutCategoryQuestionEvaluation(int id, CategoryQuestionEvaluation categoryQuestionEvaluation)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != categoryQuestionEvaluation.CategoryQuestionEvaluationID)
            {
                return BadRequest();
            }

            db.Entry(categoryQuestionEvaluation).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CategoryQuestionEvaluationExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
Beispiel #2
0
 public QuestionEvaluation(CategoryQuestionEvaluation _categoryQuestionEvaluation,
                                 string _statement, string _typeQuestion, int _position, bool _isObligatory)
 {
     categoryQuestionEvaluation = _categoryQuestionEvaluation;
     statement = _statement;
     typeQuestion = _typeQuestion;
     position = _position;
     isObligatory = _isObligatory;
 }
        public IHttpActionResult PostCategoryQuestionEvaluation(CategoryQuestionEvaluation categoryQuestionEvaluation)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            db.CategoriesQuestionsEvaluations.Add(categoryQuestionEvaluation);
            db.SaveChanges();

            return CreatedAtRoute("DefaultApi", new { id = categoryQuestionEvaluation.CategoryQuestionEvaluationID }, categoryQuestionEvaluation);
        }