using CommonHelper;
|
using GasolineBlend.BLL;
|
using GasolineBlend.Entity;
|
using SqlSugar;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using System.Web.Mvc;
|
using System.Web.Razor.Tokenizer.Symbols;
|
|
namespace GasolineBlend.Controllers
|
{
|
public class DefaultCompanyController : BaseController
|
{
|
|
|
private DefaultCompanyBLL _acc = new DefaultCompanyBLL();
|
/// <summary>
|
///获取推送
|
/// </summary>
|
/// <param name="Keyword"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public ActionResult GetDefaultCompanyIsId(int UserId)
|
{
|
try
|
{
|
var list = _acc.GetDefaultCompanyIsId(UserId);
|
if (list.Count == 0)
|
{
|
bool isAdd = _acc.AddDefaultCompany(UserId);
|
if (!isAdd) {
|
return Error();
|
}
|
var list2 = _acc.GetDefaultCompanyIsId(UserId);
|
return SuccessNoShow(data: list2);
|
}
|
return SuccessNoShow(data: list);
|
}
|
catch (Exception e)
|
{
|
LogHelper.Write(Level.Error, "获取推送 GetDefaultCompanyIsId", e, OperatorProvider.Instance.Current == null ? "GuestEx" : OperatorProvider.Instance.Current.LoginName);
|
return Error();
|
}
|
}
|
|
/// <summary>
|
///修改推送
|
/// </summary>
|
/// <param name="Keyword"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public ActionResult UpdateDefaultCompany(DefaultCompany defaultCompany)
|
{
|
try
|
{
|
bool isUpdate = _acc.UpdateDefaultCompany(defaultCompany);
|
return isUpdate ? SuccessNoShow() : Error();
|
}
|
catch (Exception e)
|
{
|
LogHelper.Write(Level.Error, "修改推送 UpdateDefaultCompany " +
|
"" +
|
"", e, OperatorProvider.Instance.Current == null ? "GuestEx" : OperatorProvider.Instance.Current.LoginName);
|
return Error();
|
}
|
}
|
|
|
|
|
/// <summary>
|
///添加推送
|
/// </summary>
|
/// <param name="Keyword"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public ActionResult AddDefaultCompany(int UserId)
|
{
|
try
|
{
|
bool isAdd = _acc.AddDefaultCompany(UserId);
|
return isAdd ? SuccessNoShow() : Error();
|
}
|
catch (Exception e)
|
{
|
LogHelper.Write(Level.Error, "添加智能体 AddPushData" +
|
"" +
|
"", e, OperatorProvider.Instance.Current == null ? "GuestEx" : OperatorProvider.Instance.Current.LoginName);
|
return Error();
|
}
|
}
|
|
|
|
|
}
|
}
|