Exemple #1
0
        public async Task <IActionResult> View([FromBody] VisitInputDto turistPlace)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            var result = await TuristPlaceService.View(turistPlace);

            return(Ok(result));
        }
Exemple #2
0
        public async Task <VisitOutputDto> View(VisitInputDto turistPlace)
        {
            var findplace = await Findplace(turistPlace.TuristPlaceName);

            var reasult = TuristPlaceRepository.GetQuery()
                          .Include(x => x.City)
                          .Include(y => y.Country)
                          .FirstOrDefault(z => z.Name == findplace.Name);

            reasult.Visit++;

            TuristPlaceRepository.Update(reasult);
            await TuristPlaceRepository.Save();

            return(mapper.Map <VisitOutputDto>(reasult));
        }