public Reply AcceptLesson(int id) { Reply reply = new Reply(); string token = GetToken(); if (userService.VerifyRol(token) != 2 && userService.VerifyRol(token) != 3) { reply.message = "No esta autorizado"; return(reply); } try { int user_id = userService.GetId(token); Lesson lesson = lessonService.FindById(id); if (user_id == lesson.teacher_id) { lessonService.AcceptLesson(id); reply.message = "Clase Aceptada"; } else { reply.message = "No esta autorizado para aceptar"; } } catch (Exception exception) { reply.message = exception.Message.ToString(); } return(reply); }