Пример #1
0
        public void TestUserCheckin()
        {
            Assert.True(CheckinDBConnector.Checkin(dataSource, "*****@*****.**", "*****@*****.**"));



            //Code to cleanup the tables so that the test case would run successfully the next time.
            string checkinDelete  = "DELETE FROM Checkin WHERE user = '******' AND admin = '*****@*****.**'";
            string userRoleDelete = "DELETE FROM AspNetUserRoles WHERE UserId = 7 AND RoleId = 2";

            using (SqliteConnection conn = new SqliteConnection(dataSource))
            {
                conn.Open();
                SqliteCommand deleteSQL = new SqliteCommand(checkinDelete, conn);

                try
                {
                    deleteSQL.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }


                deleteSQL = new SqliteCommand(userRoleDelete, conn);

                try
                {
                    deleteSQL.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }
Пример #2
0
 public IActionResult CheckinUser(User user)
 {
     CheckinDBConnector.Checkin(Constants.DATA_SOURCE, user.Username, User.Identity.Name);
     return(Redirect("/Checkin"));
 }