public async Task <IActionResult> Get(int id, bool edit = false, bool moveToSuggests = false) { var user = await _userManager.GetByIdentityAsync(this); if (user == null) { return(Unauthorized()); } var company = await _userCompanyService.GetCompanyByIdAsync(id); if (company == null) { return(NotFound($"Company with id: {id} was not found")); } var mappedCompany = _mapper.Map <Company, CompanyDto>(company); if (company.User.Id != user.Id) { if (!company.Suggestion) { return(NotFound()); } if (edit || moveToSuggests) { return(StatusCode(403)); } mappedCompany.CanEdit = false; mappedCompany.CanMoveToSuggests = false; } else { mappedCompany.CanEdit = true; mappedCompany.CanMoveToSuggests = true; } return(Ok(mappedCompany)); }