using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using WaterCloud.Code; using WaterCloud.Domain.Entity.CustomerOrder; using WaterCloud.Service.CustomerOrder; namespace WaterCloud.Web.Areas.CustomerOrder.Controllers; [Area("CustomerOrder")] public class CustomerOrderController : BaseController { public CustomerOrderService CustomerOrderService { get; set; } [HttpGet] [HandlerAjaxOnly] public async Task GetPageList(Pagination pagination, string keyword) { if (string.IsNullOrEmpty(pagination.field)) { pagination.order = "desc"; pagination.field = "F_CreatorTime"; } var data = await CustomerOrderService.GetPageList(pagination, keyword); return Success(pagination.records, data); } [HttpGet] [HandlerAjaxOnly] public async Task GetListJson(string keyword) { var data = await CustomerOrderService.GetList(keyword); return Content(data.ToJson()); } [HttpGet] [HandlerAjaxOnly] public async Task GetFormJson(string keyValue) { var data = await CustomerOrderService.GetForm(keyValue); return Content(data.ToJson()); } #region 提交数据 [HttpPost] [HandlerAjaxOnly] public async Task SubmitForm(CustomerOrderEntity entity, string keyValue) { try { await CustomerOrderService.SubmitForm(entity, keyValue); return await Success("操作成功。", "", keyValue); } catch (Exception ex) { return await Error(ex.Message, "", keyValue); } } [HttpPost] [HandlerAjaxOnly] [HandlerAuthorize] public async Task DeleteForm(string keyValue) { try { await CustomerOrderService.DeleteForm(keyValue); return await Success("操作成功。", "", keyValue, DbLogType.Delete); } catch (Exception ex) { return await Error(ex.Message, "", keyValue, DbLogType.Delete); } } #endregion 提交数据 }