public async Task <IActionResult> AddCompany(CompanyForRegisterDto companyForRegisterDto)
        {
            _repo.Add(companyForRegisterDto);

            if (await _repo.SaveAll())
            {
                var companyToReturn = _mapper.Map <CompanyForListDto>(companyForRegisterDto);
                return(CreatedAtRoute("GetCompanies", companyToReturn));
            }

            throw new Exception("Coś popszło nie tak podczas tworzenia firmy");
        }
        public async Task <IActionResult> UpdateUser(int id, UserForUpdateDto userForUpdateDto)
        {
            if (id != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value))
            {
                return(Unauthorized());
            }

            var user = await _repo.GetUser(id);

            _mapper.Map(userForUpdateDto, user);

            if (await _repo.SaveAll())
            {
                return(NoContent());
            }

            throw new Exception("Wystapil blad podczas aktualizowania uzytkownika.");
        }