示例#1
0
        public async Task <IActionResult> List()
        {
            var users = await UnitOfWork.Repository <User>().GetListAsync(u => !u.Deleted);

            var result = users.Select(u => UserResult.Create(u));

            return(Ok(result));
        }
示例#2
0
        public async Task <IActionResult> Get(string id)
        {
            Logger.LogDebug("GET[User]");

            var oid = this.GetUserId();

            if (!oid.HasValue)
            {
                return(BadRequest());
            }

            var user = await UnitOfWork.Repository <User>().GetByIdAsync(oid.Value);

            if (user == null)
            {
                return(new NotFoundObjectResult(oid));
            }

            return(Ok(UserResult.Create(user)));
        }