コード例 #1
0
        public IActionResult GetRoomTypes()
        {
            List <RoomType> roomTypes = iRoomTypeRepository.GetRoomTypes();

            /*encoding(against xss) at the get request, so as to store the entity column in its plain form in the database*/
            if (roomTypes != null)
            {
                roomTypes.ForEach(x =>
                {
                    if (x != null)
                    {
                        string encodedRoomTypeName = htmlEncoder.Encode(x.Name);
                        x.Name = encodedRoomTypeName;
                    }
                });
                return(Ok(roomTypes));
            }
            return(NotFound("No room types were found!"));
        }
コード例 #2
0
 public List <RoomType> GetRoomTypes()
 {
     return(_roomTypeRepository.GetRoomTypes().ToList());
 }
コード例 #3
0
 public async Task <IEnumerable <RoomTypes> > GetRoomTypes()
 {
     return(await _roomTypeRepository.GetRoomTypes());
 }