Ejemplo n.º 1
0
        public async Task <IActionResult> GetAccomodation(int id)
        {
            var accd = await _accomodationRepository.GetAccomodation(id);

            var accdResource = AccomodationMapper.MapAccomodationToAccomodationResource(accd);

            return(Ok(accdResource));
        }
 public async Task <ActionResult <IEnumerable <Accomodation> > > GetAccomodation([FromQuery] int pageNum = 0, [FromQuery] int pageSize = 10)
 {
     try
     {
         return(Ok(await _repoAccomodation.GetAccomodation(pageSize, pageNum)));
     }
     catch (ArgumentOutOfRangeException e)
     {
         return(BadRequest(e.Message));
     }
 }
Ejemplo n.º 3
0
        public async Task <IActionResult> GetAccomodationPhoto(int id, string sufix)
        {
            var accd = await _accomodationRepository.GetAccomodation(id);

            var accdName = accd.Name + sufix;

            var path  = Path.Combine(_hostingEnvironment.WebRootPath, "AccomodationGallery", "User1");
            var image = System.IO.File.OpenRead(path + "\\" + accdName + ".png");

            return(File(image, "image/png"));
        }