Exemplo n.º 1
0
        public async Task <IHttpActionResult> GetById(string code)
        {
            LocalDto item = null;

            try
            {
                if (await _authorizationService.AuthorizeAsync(User))
                {
                    var local = _localService.GetByCode(code);
                    item = Mapper.Map <Local, LocalDto>(local);
                }
                else
                {
                    var codeResult = new CodeResultStatus(401);
                    return(Ok(codeResult));
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }

            return(Ok(item));
        }