public IActionResult CreateTemplateQuestion([FromBody] Object json) { string JsonString = json.ToString(); EvalTemplateQuestionCategory evalTemplateQuestionCategory = JsonConvert.DeserializeObject <EvalTemplateQuestionCategory>(JsonString); if (IsInstructorForEval(evalTemplateQuestionCategory.evalTemplateID) || IsAdmin()) { long questionID = DBHelper.CreateTemplateQuestion(evalTemplateQuestionCategory.evalTemplateQuestionCategoryID, evalTemplateQuestionCategory.evalTemplateID); if (questionID > 0) { return(Ok(questionID)); } return(StatusCode(500)); } return(Unauthorized()); }
public IActionResult DeleteCategory([FromBody] Object json) { String JsonString = json.ToString(); EvalTemplateQuestionCategory category = JsonConvert.DeserializeObject <EvalTemplateQuestionCategory>(JsonString); if (IsAdmin() || IsInstructorForEval(category.evalTemplateID)) { if (DBHelper.DeleteCategory(category.evalTemplateQuestionCategoryID)) { return(Ok()); } return(StatusCode(500)); //Query failed } return(Unauthorized()); //Not an Admin or the Instructor for the course, Unauthorized (401) }