public async Task <IActionResult> Get() { var customersList = _CustomerRegistrationService.GetAll(); return(Ok(customersList)); }
public async Task <IActionResult> Get() { var customersList = _customerRegistrationService.GetAll(); List <UsersDto> usersDtos = new List <UsersDto>(); List <UserDto> customers = new List <UserDto>(); List <UserDto> merchants = new List <UserDto>(); List <UserDto> naqelUsers = new List <UserDto>(); foreach (var item in customersList) { customers.Add(new UserDto { Id = item.Id, FirstName = item.FirstName, Country = item.Country, CreatedDt = item.CreatedDt, Email = item.Email, Mobile = item.Mobile, UserName = item.FirstName + " " + item.LastName, IsActive = item.IsActive != null ? Convert.ToInt32(item.IsActive) == 1 ? "Yes" : "No" : string.Empty, // need to fix, UserType = "Customer", Address = item.Address, LastName = item.LastName }); } var naqelUserList = _naqelUsersService.GetAll(); foreach (var naqelItem in naqelUserList) { naqelUsers.Add(new UserDto { Id = naqelItem.Id, FirstName = naqelItem.FirstName, Country = naqelItem.Country, CreatedDt = naqelItem.CreatedDt, Email = naqelItem.Email, Mobile = naqelItem.Mobile, UserName = naqelItem.FirstName + " " + naqelItem.LastName, IsActive = naqelItem.IsActive != null ? Convert.ToInt32(naqelItem.IsActive) == 1 ? "Yes" : "No" : string.Empty, // need to fix, UserType = naqelItem.UserType, Address = naqelItem.Address, LastName = naqelItem.LastName }); } var merchantList = _merchantService.GetAll(); foreach (var merchantItem in merchantList) { merchants.Add(new UserDto { Id = merchantItem.Id, FirstName = merchantItem.FirstName, CreatedDt = merchantItem.CreatedDt, Email = merchantItem.Email, Country = merchantItem.Country, UserName = merchantItem.FirstName, IsActive = merchantItem.IsActive != null ? Convert.ToInt32(merchantItem.IsActive) == 1 ? "Yes" : "No" : string.Empty, // need to fix, UserType = "Merchant", Address = merchantItem.Address, LastName = merchantItem.LastName, Company = merchantItem.Company }); } usersDtos.Add(new UsersDto { Customers = customers, Naqelusers = naqelUsers, Merchants = merchants }); return(Ok(usersDtos)); }