Ejemplo n.º 1
0
        public QueryNotesResponse QueryNotes([FromBody] QueryNotesAction queryNotes)
        {
            QueryNotesResponse response = new QueryNotesResponse();

            response.Notes = new List <NoteModel>();

            if (string.IsNullOrEmpty(queryNotes.Email) ||
                string.IsNullOrEmpty(queryNotes.AuthToken) ||
                string.IsNullOrEmpty(queryNotes.QueryContents))
            {
                response.Status = "InvalidInput";
                return(response);
            }
            // Use the email and authToken to get the userId
            string userId = UserController.GetUserId(queryNotes.Email, queryNotes.AuthToken);

            if (string.IsNullOrEmpty(userId))
            {
                // Expired AuthToken
                response.Status = "Expired";
                return(response);
            }
            response.Status = "Success";
            response.Notes  = NoteModel.QueryNotes(userId, queryNotes.QueryContents, queryNotes.City, new Point(queryNotes.Longitude, queryNotes.Latitude)).AsEnumerable();
            return(response);
        }