1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using System;
- using System.Collections.Generic;
- using System.Threading;
- using Luticate2.Utils.Dbo;
- using Luticate2.Utils.Dbo.Basic;
- using Luticate2.Utils.Dbo.Result;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.AspNetCore.SignalR.Infrastructure;
-
- namespace Luticate2.Utils.Controllers
- {
- public abstract class LuController : Controller
- {
- protected IConnectionManager ConnectionManager { get; set; }
-
- protected IDictionary<object, object> LuItems => HttpContext.GetLuItems();
-
- protected LuApiWrapperDbo<T> Handle<T>(LuResult<T> result)
- {
- if (result)
- {
- return new LuApiWrapperDbo<T>
- {
- code = 200,
- data = result.Data,
- message = null,
- Version = LuUtilsExtensions.Options.Version
- };
- }
- throw new LuResultException(result.To<object>());
- }
-
- protected LuApiWrapperDbo<LuBoxedValueDbo<T>> HandleBoxed<T>(LuResult<T> result)
- {
- return Handle(result.To(arg => new LuBoxedValueDbo<T>
- {
- Value = arg
- }));
- }
- }
- }
|