DocSas/PropertyService.Domain/ModelView/property/Tenants/ResidentProvider.cs
/// <summary>
/// get residents as an asynchronous operation.
/// </summary>
/// <param name="propertyInfoId">The property information identifier.</param>
/// <param name="userId">The user identifier.</param>
/// <returns>Task&lt;DSCResponse&gt;.</returns>
get residents as an asynchronous operation.
get residents as an asynchronous operation .
public async Task<DSCResponse> GetResidentsAsync(Guid propertyInfoId, Guid userId)
        {
            var msg = new Dictionary<string, string>();
            var response = new DSCResponse();
            IEnumerable<ResidentsVM> residents = null;
            var user = await _appCommon.GetUserAsync(userId);
            if (user != null)
            {
                if (user.UserTypeEnum == PSUserType.ManagementCompany.ToString())
                {
                    residents = await _tenantUnitRepo.GetQueryAsync<ResidentsVM>("GetResidents", new Dictionary<string, object>() {
                        {"recordCount", DataUtil.DefaultNumberOfRows },
                        {"propertyId",propertyInfoId }
                    });
                }
                else if (user.UserTypeEnum == PSUserType.ManagementPersonnel.ToString())
                {
                    residents = await _tenantUnitRepo.GetQueryAsync<ResidentsVM>("GetResidents", new Dictionary<string, object>() {
                        {"recordCount", DataUtil.DefaultNumberOfRows },
                        {"propertyId",propertyInfoId }
                    });
                }
                else
                {
                    residents = await _tenantUnitRepo.GetQueryAsync<ResidentsVM>("GetResidents", new Dictionary<string, object>() {
                        {"recordCount", DataUtil.DefaultNumberOfRows },
                        {"propertyId",propertyInfoId },
                        {"userId",userId }
                    });
                }
            }
            response.ResponseData = residents;
            response.ErrorMessage = msg;
            return response;
        }
public async Task < DSCResponse > GetResidentsAsync ( Guid propertyInfoId , Guid userId ) { var msg = new Dictionary < string , string > ( ) ; var response = new DSCResponse ( ) ; IEnumerable < ResidentsVM > residents = null ; var user = await _appCommon . GetUserAsync ( userId ) ; if ( user != null ) { if ( user . UserTypeEnum == PSUserType . ManagementCompany . ToString ( ) ) { residents = await _tenantUnitRepo . GetQueryAsync < ResidentsVM > ( " " , new Dictionary < string , object > ( ) { { " " , DataUtil . DefaultNumberOfRows } , { " " , propertyInfoId } } ) ; } else if ( user . UserTypeEnum == PSUserType . ManagementPersonnel . ToString ( ) ) { residents = await _tenantUnitRepo . GetQueryAsync < ResidentsVM > ( " " , new Dictionary < string , object > ( ) { { " " , DataUtil . DefaultNumberOfRows } , { " " , propertyInfoId } } ) ; } else { residents = await _tenantUnitRepo . GetQueryAsync < ResidentsVM > ( " " , new Dictionary < string , object > ( ) { { " " , DataUtil . DefaultNumberOfRows } , { " " , propertyInfoId } , { " " , userId } } ) ; } } response . ResponseData = residents ; response . ErrorMessage = msg ; return response ; }
get residents as an asynchronous operation.
get residents as an asynchronous operation .
None
propertyInfoId
Guid
The property information identifier.
The property information identifier .
userId
Guid
The user identifier.
The user identifier .