Exemplo n.º 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!"));
        }
Exemplo n.º 2
0
 public List <RoomType> GetRoomTypes()
 {
     return(_roomTypeRepository.GetRoomTypes().ToList());
 }
Exemplo n.º 3
0
 public async Task <IEnumerable <RoomTypes> > GetRoomTypes()
 {
     return(await _roomTypeRepository.GetRoomTypes());
 }