public IHttpActionResult Get([FromUri] QueryRealEstates query)
        {
            if (query == null)
            {
                query = new QueryRealEstates()
                {
                    Skip = 0,
                    Take = 10
                };
            }

            if (query.Skip == null)
            {
                query.Skip = 0;
            }

            if (query.Take == null)
            {
                query.Take = 10;
            }


            var result = this.realEstates.Top10RealEstates(query.Skip.Value, query.Take.Value).ProjectTo <RealEstateResponseModel>().ToList();;

            return(this.Ok(result));
        }
Пример #2
0
        public IHttpActionResult Get(string id, [FromUri] QueryRealEstates query)
        {
            if (query == null)
            {
                query = new QueryRealEstates()
                {
                    Skip = 0,
                    Take = 10
                };
            }
            if (query.Skip == null)
            {
                query.Skip = 0;
            }

            if (query.Take == null)
            {
                query.Take = 10;
            }

            var comments = this.comments.GetAllByUserName(id, query.Skip.Value, query.Take.Value).ToList();

            return(this.Ok(Mapper.Map <List <CommentResponseModel> >(comments)));
        }