public IActionResult Search([FromBody] SearchPhotoOptions options) { var photo = photoService .SearchPhoto(options) .ToList(); if (photo == null) { return(BadRequest()); } if (photo.Count == 0) { return(NotFound()); } return(Json(photo)); }
public IQueryable <Photo> SearchPhoto( SearchPhotoOptions options) { if (options == null) { return(null); } var query = context_ .Set <Photo>() .AsQueryable(); if (options.PhotoId != null) { query = query.Where(p => p.PhotoId == options.PhotoId.Value); } query = query.Take(500); return(query); }