示例#1
0
        public async Task <IListResponse <DtoUser> > GetUsers()
        {
            var response = new ListResponse <DtoUser>();
            var getUsers = _UserRepository.GetAll();

            if (await getUsers.AnyAsync())
            {
                response.Model = _mapper.Map <List <DtoUser> >(await getUsers.ToListAsync());
                response.SetResponse(false, HttpResponseMessages.DATA_FOUND_SUCCESS, HttpStatusCode.OK);
            }
            else
            {
                response.Model = null;
                response.SetResponse(false, HttpResponseMessages.NO_DATA_FOUND, HttpStatusCode.OK);
            }
            return(response);
        }