You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.5 KiB
C#

1 month ago
using Infrastructure;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using OpenAuth.App;
using OpenAuth.App.Response;
using OpenAuth.Repository.Domain;
using System.Threading.Tasks;
namespace OpenAuth.WebApi.Controllers.BaseControllers
{
[Route("api/[controller]/[action]")]
[ApiController]
public class SysAppSettingController : ControllerBase
{
private readonly SysAppSettingApp _app;
public SysAppSettingController(SysAppSettingApp app)
{
_app = app;
}
[AllowAnonymous]
[HttpGet]
public async Task<Response<SysAppSetting>> Get(long id)
{
var result = new Response<SysAppSetting>();
try
{
result.Result = await _app.Get(id);
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
[AllowAnonymous]
[HttpPost]
public async Task<Response<bool>> Save(SysAppSetting obj)
{
var result = new Response<bool>();
try
{
result = await _app.Save(obj);
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
}
}