Esempio n. 1
0
        public async Task <AddVisitDto> AddVisit(AddVisitDto addVisitDto)
        {
            var visitToAdd = _mapper.Map <Visit>(addVisitDto);

            var addedVisit = await _visitRepository.AddVisit(visitToAdd);

            var result = _mapper.Map <AddVisitDto>(addedVisit);

            return(result);
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([FromBody] AddVisitDto visit)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var response = await _visitService.AddVisit(visit);

            if (response == null)
            {
                return(BadRequest());
            }

            return(Ok(response));
        }