public IHttpActionResult GetAllTeachersByName([FromUri] string teacherName) { try { var retVal = service.GetAllByName(teacherName); logger.Info("Returning all teachers with name and/or surname containing \"{0}\"", teacherName); return(Ok(retVal)); } catch (Exception e) { logger.Warn("Caught exception with message {0}", e.Message); return(NotFound()); } }