/// <summary> /// Add users view /// </summary> /// <param name="id"></param> /// <returns>View users</returns> public async Task <IActionResult> AddUsers(int id) { var transactionDto = await _transactionsService.GetTransactionAsync(id); var profilesDto = await _groupService.GetAsyncProfilesByGroup(transactionDto.GroupId); var profiles = new List <UserProfileModel>(); foreach (var profileDto in profilesDto) { var userStatus = await _transactionsService.CheckUserInTransactionAsync(id, profileDto.Id); profiles.Add(new UserProfileModel { Id = profileDto.Id, UserId = profileDto.UserId, LastName = profileDto.LastName, FirstName = profileDto.FirstName, MiddleName = profileDto.MiddleName, UserStatus = userStatus }); } var transactionViewModel = new TransactionViewModel { Id = transactionDto.Id, Description = transactionDto.Description, Comment = transactionDto.Comment, Amount = transactionDto.Amount, CurrencyType = transactionDto.CurrencyType, CreationTime = transactionDto.CreationTime, ProfileId = transactionDto.ProfileId, GroupId = transactionDto.GroupId, Profiles = profiles }; return(View(transactionViewModel)); }