1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- using Cksoft.Data;
- using Cksoft.Data.Repository;
- using DllEapDal;
- using DllEapEntity;
- using DllEapEntity.Dtos;
- using Microsoft.AspNetCore.Authorization;
- using Microsoft.AspNetCore.Mvc;
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace DllEapBll.OFILM
- {
- [Route("eap/api/[controller]/[action]")]
- [ApiController]
- [Authorize]
- public class AnnouncementController: ControllerBase
- {
- [HttpPost]
- public LayuiModel<string> Add(Announcement announcement)
- {
- using (IDatabase CurrDb = DbFactory.Base("eap"))
- {
- AnnouncementDal announcementDal = new AnnouncementDal(CurrDb);
- string i = "";
- if (announcement.id > 0)
- {
- i = announcementDal.Update(announcement);
- }
- else
- {
- i = announcementDal.Add(announcement);
- }
- LayuiModel<string> LayuiModel = new LayuiModel<string>();
- if (i == "新增成功" || i == "修改成功")
- {
- LayuiModel.code = 1;
- }
- else LayuiModel.code = 0;
- LayuiModel.msg = i;
- return LayuiModel;
- }
- }
-
- [HttpGet]
- public LayuiModel<Announcement> Get()
- {
- using (IDatabase CurrDb = DbFactory.Base("eapslave"))
- {
- AnnouncementDal announcementDal = new AnnouncementDal(CurrDb);
- var data = announcementDal.Get();
- LayuiModel<Announcement> LayuiModel = new LayuiModel<Announcement>();
- if (data == null)
- {
- LayuiModel.code = 1;
- LayuiModel.msg = "暂无数据";
- }
- else
- {
- LayuiModel.code = 1;
- LayuiModel.data = data;
- LayuiModel.count = 1;
- }
- return LayuiModel;
- }
-
- }
- }
- }
|