Exemplo n.º 1
0
        public void CanInsertUser()
        {
            var session = NHibernateHelper.GetCurrentSession();

            var user = new User { Name = "Neo", Email = "*****@*****.**", Password = "******" };
            session.Save(user);

            NHibernateHelper.CloseSession();
        }
Exemplo n.º 2
0
        public void CanInsertComment()
        {
            var session = NHibernateHelper.GetCurrentSession();

            var project = new Project { Title = "Test", Description = "test" };
            session.Save(project);
            var ticket = new Ticket { Project = project, Title = "Test Ticket", Description = "Test test" };
            session.Save(ticket);
            var user = new User { Name = "Neo", Email = "*****@*****.**", Password = "******" };
            session.Save(user);
            var comment = new Comment { Body = "This is a comment", CreatedAt = DateTime.Now, Ticket = ticket, User = user };
            session.Save(comment);

            NHibernateHelper.CloseSession();
        }
Exemplo n.º 3
0
        public static async void Login(string Email, string Password)
        {
            user.Email = Email;
            user.Password = Password;

            var httpClient = new appHttpClient();

            var response = await httpClient.GetAsync("Users");
            try
            {
                response.EnsureSuccessStatusCode(); // Throw on error code.
            } catch {
                user = new User();
            }

            var result = await response.Content.ReadAsStringAsync();

            user = JsonConvert.DeserializeObject<User>(result);
        }