General.Web/Controllers/Admin/OrganizationController.cs
(开头部分) 5KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using General.Entities.Models;
using General.Entities.ViewData.Department;
using General.Framework;
using General.Mvc.Filters;
using General.Services.Department;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace General.Web.Controllers.Admin
{
[Route("api/admin/[controller]/[action]")]
[ApiController]
[ServiceFilter(typeof(ResponseLogTimeFilter))]
public class OrganizationController : Controller
{
private readonly IDepartmentService departmentService;
public OrganizationController(IDepartmentService departmentService)
{
this.departmentService = departmentService;
}
/// <summary>
/// 查询列表
/// </summary>
/// <returns></returns>
[HttpGet]
[ServiceFilter(typeof(AdminCheckFilter))]
public async Task<IActionResult> GetList()
{
var list = await departmentService.GetList();
return Content(JsonHelper.Serialize(list));
}
/// <summary>
/// 增加机构
/// </summary>
/// <returns></returns>
[HttpPost]
[ServiceFilter(typeof(AdminCheckFilter))]
public async Task<IActionResult> AddData([FromForm]DepartmentModel model)
{
if (model.select != null)
{
var parentRes = await departmentService.GetDataByID(Convert.ToInt32(model.select));
if (model.organizationType < parentRes.organizationType)
{
return Content(new AjaxResult().Error("添加失败!机构类型不能比上级级别高!"));
}
}
var user = JsonHelper.Deserialize<tc_admin>(HttpContext.Session.GetString("Admin"));
await departmentService.AddInfo(model, user.id);
return Content(new AjaxResult().Ok("添加成功!"));
}
后面还有 82 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
