using Microsoft.AspNetCore.Mvc; using System.Threading.Tasks; using Volo.Abp; using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.Authorization; namespace BookStore.Controllers; [Route("api/wrap")] public class WrapController : AbpControllerBase { [HttpGet("string")] public Task GetResultAsync() { return Task.FromResult("Hello!"); } [HttpGet("person")] public Task GetPersonAsync() { var person = new Person { Name = "wwwk", Age = 18 }; return Task.FromResult(person); } [HttpGet("throw-exception")] public Task ThrowException() { throw new UserFriendlyException("触发了一个异常!"); } [HttpGet("throw-auth-exception")] public Task ThrowAuthException() { throw new AbpAuthorizationException(code: AbpAuthorizationErrorCodes.GivenPolicyHasNotGrantedForGivenResource); } } public class Person { public string Name { get; set; } public int Age { get; set; } }