66 lines
1.7 KiB
C#
66 lines
1.7 KiB
C#
|
||
using EasyEncryption;
|
||
using Newtonsoft.Json;
|
||
using Newtonsoft.Json.Linq;
|
||
using SWS.CAD.Models;
|
||
using SWS.CAD.Models.NoEntity;
|
||
using SWS.Commons;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Net.Http;
|
||
using System.Threading.Tasks;
|
||
|
||
namespace SWS.CAD.Services
|
||
{
|
||
public class SettingsService : HttpService
|
||
{
|
||
public SettingsService() : base()
|
||
{
|
||
|
||
}
|
||
/// <summary>
|
||
/// 根据名字拿
|
||
/// </summary>
|
||
/// <param name="settingName"></param>
|
||
/// <param name="projId"></param>
|
||
/// <returns></returns>
|
||
public async Task<List<ec_projectSettings>> GetList()
|
||
{
|
||
|
||
var res = await this.GetAsync<List<ec_projectSettings>>($"SettingsApi/GetList?projId={GlobalObject.curProject?.ProjectId}");
|
||
if (res.code == 200)
|
||
{
|
||
return res.data;
|
||
}
|
||
else
|
||
{
|
||
}
|
||
return null;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 新增或者修改。根据Name来的,id不重要
|
||
/// </summary>
|
||
/// <param name="entity"></param>
|
||
/// <param name="projId"></param>
|
||
/// <returns></returns>
|
||
public async Task<object> SaveEntitys(List<ec_projectSettings> entity)
|
||
{
|
||
var res = await this.PostBodyAsync<ec_projectSettings, List<ec_projectSettings>> ($"SettingsApi/SaveEntitys?projId={GlobalObject.curProject?.ProjectId}", entity);
|
||
if (res.code == 200)
|
||
{
|
||
//return res.info;
|
||
return null;
|
||
}
|
||
else
|
||
{
|
||
return res.info; // 返回错误信息
|
||
}
|
||
|
||
}
|
||
|
||
|
||
}
|
||
}
|