Example #1
0
        public void Add(WebHookSession session)
        {
            var model = WebHookSessionModel.FromRepositoryType(session, _computers);

            _webHookSessions.Add(model);

            _save();

            session.SetId(model.Id);
        }
Example #2
0
        public static WebHookSession Create(Computer computer)
        {
            var result = new WebHookSession
            {
                Computer = computer,
                LastPing = DateTime.UtcNow,
                Token = Guid.NewGuid().ToString()
            };

            return result;
        }
Example #3
0
        public WebHookSession ToRepositoryType()
        {
            var result = new WebHookSession(
                computer: Computer.ToRepositoryType(),
                id: Id,
                lastPing: LastPing,
                token: Token
            );

            return result;
        }
Example #4
0
        public static WebHookSession Create(Computer computer)
        {
            var result = new WebHookSession
            {
                Computer = computer,
                LastPing = DateTime.UtcNow,
                Token    = Guid.NewGuid().ToString()
            };

            return(result);
        }
Example #5
0
        public static WebHookSessionModel FromRepositoryType(WebHookSession model, DbSet<ComputerModel> computers)
        {
            var result = new WebHookSessionModel
            {
                Computer = computers.Find(model.Computer.Id),
                Id = model.Id,
                LastPing = model.LastPing,
                Token = model.Token,
            };

            return result;
        }