public async Task <IActionResult> Get([FromHeader] string sender, int id) { try { if (sender == null) { return(Unauthorized()); } Employee user = JsonConvert.DeserializeObject <Employee>(sender); var import = await impServ.Get(id); if (!user.IsAdmin() && user.WarehouseId != import.WarehouseId) { return(Unauthorized()); } if (import == null) { return(NotFound()); } else { return(Ok(import)); } } catch (Exception ex) { Console.Error.WriteLine(ex.Message); return(StatusCode(500)); } }