Example #1
0
        /// <summary>
        /// Get house with maximum water value
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public GetHouseWithMaxWCResponse GetHouseWithMaxWC(GetHouseWithMaxWCRequest request)
        {
            using (var context = GetContext())
            {
                var house = context.House
                            .OrderByDescending(h => h.WaterCounter.WaterValues)
                            .FirstOrDefault();

                return(new GetHouseWithMaxWCResponse()
                {
                    House = HouseConverter.ConvertHouse(house)
                });
            }
        }
Example #2
0
        /// <summary>
        /// Get all list of all houses
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public GetHousesResponse GetHouses(GetHousesRequest request)
        {
            using (var context = GetContext())
            {
                var houses = context.House
                             .ToList()
                             .Select(h => HouseConverter.ConvertHouse(h))
                             .ToList();

                return(new GetHousesResponse()
                {
                    HouseList = houses
                });
            }
        }