Пример #1
0
        public async Task <IActionResult> Get()
        {
            try
            {
                var toMap = await _libriService.GetLibri();

                var res = AnswerLibro.MappaPerLista(toMap);
                return(Ok(res));
            }
            catch (Exception)
            {
                return(StatusCode(500, null));
            }
        }
Пример #2
0
        public async Task <IActionResult> Get(int id)
        {
            try
            {
                var toMap = await _libriService.GetLibro(id);

                if (toMap == null)
                {
                    return(NotFound());
                }
                else
                {
                    return(Ok(AnswerLibro.MappaLibro(toMap)));
                }
            }
            catch (Exception)
            {
                return(StatusCode(500, null));

                throw;
            }
        }