Пример #1
0
 public TerminalModel(Terminal terminal)
 {
     this.Id = terminal.Id;
     this.DepartmentName = terminal.Department != null ? terminal.Department.Name : "";
     this.Name = terminal.Name;
     this.Mac = terminal.Mac;
     this.Ip = terminal.Ip;
     this.CurIp = terminal.CurIp;
     this.LastLoginTime = terminal.LastLoginTime.ToJsonString();
     this.Note = terminal.Note;
     this.CreateTime = terminal.CreateTime.ToJsonString();
 }
Пример #2
0
        public ActionResult ClientInfo(string mac, string ip)
        {
            try
            {
                Terminal terminal = this.TerminalRepository.GetBy(mac);

                if (terminal == null)
                {
                    terminal = new Terminal();
                }

                terminal.CurIp = ip;
                terminal.Mac = mac;

                terminal = this.TerminalRepository.SaveOrUpdate(terminal);

                return JsonSuccess(terminal);
            }
            catch (Exception ex)
            {
                return JsonError(ex.Message);
            }
        }
Пример #3
0
 public static TerminalModel From(Terminal terminal)
 {
     return new TerminalModel(terminal);
 }