예제 #1
0
        public Response <string> Add([FromHeader] OutBoxListReq request)
        {
            var result = new Response <string>();
            var view   = new OutBoxView
            {
                username = request.username,
                Mbno     = request.Mbno,
                Msg      = request.Msg,
                SendTime = DateTime.Now,
                ComPort  = request.ComPort,
                Report   = request.Report,
                IsDel    = request.IsDel,
            };

            try
            {
                _app.Add(view);
                result.Result = view.id;
            }
            catch (Exception ex)
            {
                result.Code    = 500;
                result.Message = ex.InnerException?.Message ?? ex.Message;
            }
            return(result);
        }
예제 #2
0
 public void Update(OutBoxView view)
 {
     UnitWork.Update <OutBox>(u => u.Id == view.id, u => new OutBox
     {
         username = view.username,
         Mbno     = view.Mbno,
         Msg      = view.Msg,
         SendTime = DateTime.Now,
     });
     UnitWork.Save();
 }
예제 #3
0
        public void Add(OutBoxView view)
        {
            OutBox outBox = view;

            outBox.username = view.username;
            outBox.Mbno     = view.Mbno;
            outBox.Msg      = view.Msg;
            outBox.SendTime = DateTime.Now;
            UnitWork.Add(outBox);
            UnitWork.Save();
        }
예제 #4
0
        public Response <string> Update([FromHeader] OutBoxListReq request)
        {
            var result = new Response <string>();
            var view   = new OutBoxView
            {
                id       = request.Id,
                username = request.username,
                Mbno     = request.Mbno,
                Msg      = request.Msg,
                SendTime = request.SendTime,
            };

            try
            {
                _app.Update(view);
                result.Result = view.id;
            }
            catch (Exception ex)
            {
                result.Code    = 500;
                result.Message = ex.InnerException?.Message ?? ex.Message;
            }
            return(result);
        }