Exemplo n.º 1
0
 public bool ChangePassword(int id)
 {
     var json = new Enlace().EjecutarAccion(url + "/" + id + Formato, "POST", this);
     var usuario = new JavaScriptSerializer().Deserialize<LoginModel>(json);
     if (usuario.status.Equals("OK"))
     {
         return true;
     }
     return false;
 }
Exemplo n.º 2
0
 public Group[] GetGroupsByProfessor(int professor_id)
 {
     var json = new Enlace().EjecutarAccion(url + "/" + professor_id.ToString() + "/groups" + Formato, "GET").Replace("null", "\"0\"");
     return new JavaScriptSerializer().Deserialize<Group[]>(json);
 }
Exemplo n.º 3
0
 public Professor Find(int pID)
 {
     var json = new Enlace().EjecutarAccion(url + "/" + pID.ToString() + Formato, "GET").Replace("null", "\"0\"");
     return new JavaScriptSerializer().Deserialize<Professor>(json);
 }
Exemplo n.º 4
0
 public Group[] ToList()
 {
     var json = new Enlace().EjecutarAccion(url + Formato, "GET").Replace("null", "\"0\"");
     return new JavaScriptSerializer().Deserialize<Group[]>(json);
 }
Exemplo n.º 5
0
 public Student[] GetStudentsByGroup(int group_id)
 {
     var json = new Enlace().EjecutarAccion(url + "/" + group_id.ToString() + "/students" + Formato, "GET").Replace("null", "\"0\"");
     return new JavaScriptSerializer().Deserialize<Student[]>(json);
 }
Exemplo n.º 6
0
 public Test[] GetTestsByStudent(int student_id)
 {
     var json = new Enlace().EjecutarAccion(url + "/" + student_id.ToString() + "/tests" + Formato, "GET").Replace("null", "\"0\"");
     return new JavaScriptSerializer().Deserialize<Test[]>(json);
 }
Exemplo n.º 7
0
 public Student Add(Student nuevo)
 {
     nuevo.serializar = true;
     var json = new Enlace().EjecutarAccion(url + Formato, "POST", nuevo);
     return new JavaScriptSerializer().Deserialize<Student>(json);
 }
Exemplo n.º 8
0
 public Answer[] ObtenerRespuestas(int question_id)
 {
     var json = new Enlace().EjecutarAccion(url + "/" + question_id.ToString() + "/answers" + Formato, "GET").Replace("null", "\"0\"");
     return new JavaScriptSerializer().Deserialize<Answer[]>(json);
 }
Exemplo n.º 9
0
 public Answer CalificarRespuesta(int answer_id, int valor_asignado)
 {
     var json = new Enlace().EjecutarAccion(url + "/grade/" + answer_id.ToString() + Formato, "PUT", new { valor_asignado = valor_asignado }).Replace("null", "\"0\"");
     return new JavaScriptSerializer().Deserialize<Answer>(json);
 }
Exemplo n.º 10
0
 public bool UserValid()
 {
     var json = new Enlace().EjecutarAccion(url + Formato, "POST", this);
     var usuario= new JavaScriptSerializer().Deserialize<LoginModel>(json);
     if (usuario.status.Equals("OK"))
     {
         this.id = usuario.id;
         this.Nombre = usuario.Nombre;
         this.tipo = usuario.tipo;
         this.rol = usuario.rol;
         this.Password = usuario.Password;
         System.Web.HttpContext.Current.Session["usuario"] = usuario;
         return true;
     }
     return false;
 }
Exemplo n.º 11
0
 public Boolean test_calificar_respuesta(int test_id, Answer respuesta)
 {
     respuesta.serializar = true;
     var json = new Enlace().EjecutarAccion(url + "/" + test_id.ToString() + "/answers" + Formato, "POST", respuesta);
     return json != "";
 }
Exemplo n.º 12
0
 public void RemoveQuestionFromTest(int id, int question_id)
 {
     var json = new Enlace().EjecutarAccion(url + "/" + id.ToString() + "/questions/" + question_id.ToString() + Formato, "DELETE");
 }
Exemplo n.º 13
0
 public int get_time_remaining(int test_id)
 {
     var json = new Enlace().EjecutarAccion(url + "/" + test_id.ToString() + "/time_remaining" + Formato, "GET");
     return Int32.Parse(json);
 }
Exemplo n.º 14
0
 public Answer[] GetTestAnswersByStudent(int test_id, int student_id)
 {
     var json = new Enlace().EjecutarAccion(url + "/" + test_id.ToString() +
         "/students/" + student_id.ToString() + "/answers" + Formato, "GET");
     return new JavaScriptSerializer().Deserialize<Answer[]>(json);
 }
Exemplo n.º 15
0
 public Boolean AddQuestionToTest(int test_id, Question pregunta)
 {
     pregunta.serializar = true;
     var json  = new Enlace().EjecutarAccion(url + "/" + test_id.ToString() + "/questions" + Formato, "POST", pregunta);
     return json != "";
 }