Пример #1
0
        /// <summary>
        /// the endpoint enables users to search for direct attached storages
        /// </summary>
        /// <param name="Search">search vector</param>
        /// <returns>best match</returns>
        public ResponseWrapper <List <MatchingResponse> > Search(SearchVector Search, string username)
        {
            if (Search.total == 0)
            {
                return new ResponseWrapper <List <MatchingResponse> >
                       {
                           state = HttpStatusCode.BadRequest,
                           error = "Fehlerhafte Eingabe: vergebenes Rating muss ingesamt mindestens 1 sein. Wert: 0"
                       }
            }
            ;
            var output = new List <MatchingResponse>();

            foreach (DirectAttachedStorageService Service in _Ctx.DirectAttachedStorageService.ToList())
            {
                var result = Service.MatchWithSearchVector(Search);

                if (((result.points / Search.total) * 100) >= Search.minFulfillmentPercentage)
                {
                    output.Add(result);
                }
            }
            return(new ResponseWrapper <List <MatchingResponse> >
            {
                state = System.Net.HttpStatusCode.OK,
                content = output
            });
        }
    }
        public IHttpActionResult Search([FromBody] SearchVector Search)
        {
            var result = _Repo.Search(Search, User.Identity.Name);

            if (result.error != null)
            {
                return(Content(result.state, result.error));
            }
            _Repo.saveUserSearch(User.Identity.Name);
            return(Content(result.state, result.content));
        }
Пример #3
0
        new public MatchingResponse MatchWithSearchVector(SearchVector Search)
        {
            MatchingResponse Output = base.MatchWithSearchVector(Search);

            return(Output);
        }