public HttpResponseMessage GetTeacher(int id) { TeacherResponseModel response = new TeacherResponseModel(); IList <Teacher> teachers = _repository.GetTeacher(id); if (teachers.Count > 0) { response.Success = "true"; response.Teacher = teachers; } else { response.Success = "false"; response.Teacher = teachers; } return(Request.CreateResponse(HttpStatusCode.OK, response)); }
public HttpResponseMessage Get(int id) { TeacherResponseModel response = new TeacherResponseModel(); Teacher teacher = _repository.Get(id); if (teacher == null) { response.Success = "false"; } else { response.Success = "true"; response.Teacher.Add(teacher); } return(Request.CreateResponse(HttpStatusCode.OK, response)); }