Esempio n. 1
0
        // DELETE parties/values/id
        public void Delete(int id)
        {
            DatabaseOperations db      = new DatabaseOperations();
            MySqlCommand       command = new MySqlCommand("DELETE FROM Parties WHERE PartieId=@Id");

            command.Parameters.AddWithValue("@Id", id);

            db.ExecuteQuery(command);
        }
Esempio n. 2
0
        // POST classRooms/values
        public void Post([FromBody] ClassRoom data)
        {
            DatabaseOperations db      = new DatabaseOperations();
            MySqlCommand       command = new MySqlCommand("INSERT INTO ClassRooms(Name,  CreationTime) VALUES(@Name,  @CreationTime)");

            command.Parameters.AddWithValue("@Name", data.Name);
            command.Parameters.AddWithValue("@CreationTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

            db.ExecuteQuery(command);
        }
        // POST notifications/values
        public void Post([FromBody] Notification data)
        {
            DatabaseOperations db      = new DatabaseOperations();
            MySqlCommand       command = new MySqlCommand("INSERT INTO Notifications(Title,  Message,  CreationTime) VALUES(@Title,  @Message,  @CreationTime)");

            command.Parameters.AddWithValue("@Title", data.Title);
            command.Parameters.AddWithValue("@Message", data.Message);
            command.Parameters.AddWithValue("@CreationTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

            db.ExecuteQuery(command);
        }
        // POST studentClasses/values
        public void Post([FromBody] StudentClasse data)
        {
            DatabaseOperations db      = new DatabaseOperations();
            MySqlCommand       command = new MySqlCommand("INSERT INTO StudentClasses(StudentId,  ClasseId,  CreationTime) VALUES(@StudentId,  @ClasseId,  @CreationTime)");

            command.Parameters.AddWithValue("@StudentId", data.StudentId);
            command.Parameters.AddWithValue("@ClasseId", data.ClasseId);
            command.Parameters.AddWithValue("@CreationTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

            db.ExecuteQuery(command);
        }
Esempio n. 5
0
        // POST candidats/values
        public void Post([FromBody] Candidat data)
        {
            DatabaseOperations db      = new DatabaseOperations();
            MySqlCommand       command = new MySqlCommand("INSERT INTO Candidats(Nume,  Descriere,  Functie,  CreationTime) VALUES(@Nume,  @Descriere,  @Functie,  @CreationTime)");

            command.Parameters.AddWithValue("@Nume", data.Nume);
            command.Parameters.AddWithValue("@Descriere", data.Descriere);
            command.Parameters.AddWithValue("@Functie", data.Functie);
            command.Parameters.AddWithValue("@CreationTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

            db.ExecuteQuery(command);
        }
        // POST tokenUsers/values
        public void Post([FromBody] TokenUser data)
        {
            DatabaseOperations db      = new DatabaseOperations();
            MySqlCommand       command = new MySqlCommand("INSERT INTO TokenUsers(Username,  Password,  Type,  CreationTime) VALUES(@Username,  @Password,  @Type,  @CreationTime)");

            command.Parameters.AddWithValue("@Username", data.Username);
            command.Parameters.AddWithValue("@Password", data.Password);
            command.Parameters.AddWithValue("@Type", data.Type);
            command.Parameters.AddWithValue("@CreationTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

            db.ExecuteQuery(command);
        }
Esempio n. 7
0
        // POST cards/values
        public void Post([FromBody] Card data)
        {
            DatabaseOperations db      = new DatabaseOperations();
            MySqlCommand       command = new MySqlCommand("INSERT INTO Cards(PlayerId,  Type,  Number,  CreationTime) VALUES(@PlayerId,  @Type,  @Number,  @CreationTime)");

            command.Parameters.AddWithValue("@PlayerId", data.PlayerId);
            command.Parameters.AddWithValue("@Type", data.Type);
            command.Parameters.AddWithValue("@Number", data.Number);
            command.Parameters.AddWithValue("@CreationTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

            db.ExecuteQuery(command);
        }
Esempio n. 8
0
        // POST users/values
        public void Post([FromBody] User data)
        {
            DatabaseOperations db      = new DatabaseOperations();
            MySqlCommand       command = new MySqlCommand("INSERT INTO Users(FirstName,  LastName,  Email,  Type,  CreationTime) VALUES(@FirstName,  @LastName,  @Email,  @Type,  @CreationTime)");

            command.Parameters.AddWithValue("@FirstName", data.FirstName);
            command.Parameters.AddWithValue("@LastName", data.LastName);
            command.Parameters.AddWithValue("@Email", data.Email);
            command.Parameters.AddWithValue("@Type", data.Type);
            command.Parameters.AddWithValue("@CreationTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

            db.ExecuteQuery(command);
        }
Esempio n. 9
0
        // POST tokens/values
        public void Post([FromBody] Token data)
        {
            DatabaseOperations db      = new DatabaseOperations();
            MySqlCommand       command = new MySqlCommand("INSERT INTO Tokens(TokenUserId,  Value,  Address,  LastUpdate,  CreationTime) VALUES(@TokenUserId,  @Value,  @Address,  @LastUpdate,  @CreationTime)");

            command.Parameters.AddWithValue("@TokenUserId", data.TokenUserId);
            command.Parameters.AddWithValue("@Value", data.Value);
            command.Parameters.AddWithValue("@Address", data.Address);
            command.Parameters.AddWithValue("@LastUpdate", data.LastUpdate);
            command.Parameters.AddWithValue("@CreationTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

            db.ExecuteQuery(command);
        }
Esempio n. 10
0
        // POST marks/values
        public void Post([FromBody] Mark data)
        {
            DatabaseOperations db      = new DatabaseOperations();
            MySqlCommand       command = new MySqlCommand("INSERT INTO Marks(ClasseId,  StudentId,  TeacherId,  Value,  Date,  CreationTime) VALUES(@ClasseId,  @StudentId,  @TeacherId,  @Value,  @Date,  @CreationTime)");

            command.Parameters.AddWithValue("@ClasseId", data.ClasseId);
            command.Parameters.AddWithValue("@StudentId", data.StudentId);
            command.Parameters.AddWithValue("@TeacherId", data.TeacherId);
            command.Parameters.AddWithValue("@Value", data.Value);
            command.Parameters.AddWithValue("@Date", data.Date);
            command.Parameters.AddWithValue("@CreationTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

            db.ExecuteQuery(command);
        }
Esempio n. 11
0
        // POST candidates/values
        public void Post([FromBody] Candidate data)
        {
            DatabaseOperations db      = new DatabaseOperations();
            MySqlCommand       command = new MySqlCommand("INSERT INTO Candidates(Name,  Email,  Password,  Description,  Role,  CreationTime) VALUES(@Name,  @Email,  @Password,  @Description,  @Role,  @CreationTime)");

            command.Parameters.AddWithValue("@Name", data.Name);
            command.Parameters.AddWithValue("@Email", data.Email);
            command.Parameters.AddWithValue("@Password", data.Password);
            command.Parameters.AddWithValue("@Description", data.Description);
            command.Parameters.AddWithValue("@Role", data.Role);
            command.Parameters.AddWithValue("@CreationTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

            db.ExecuteQuery(command);
        }
Esempio n. 12
0
        // PUT candidates/valuesd
        public void PUT([FromBody] Candidate data)
        {
            DatabaseOperations db      = new DatabaseOperations();
            MySqlCommand       command = new MySqlCommand("UPDATE  Candidates SET Name=@Name,  Email=@Email,  Password=@Password,  Description=@Description,  Role=@Role WHERE CandidateId=@Id");

            command.Parameters.AddWithValue("@Id", data.CandidateId);
            command.Parameters.AddWithValue("@Name", data.Name);
            command.Parameters.AddWithValue("@Email", data.Email);
            command.Parameters.AddWithValue("@Password", data.Password);
            command.Parameters.AddWithValue("@Description", data.Description);
            command.Parameters.AddWithValue("@Role", data.Role);
            command.Parameters.AddWithValue("@CreationTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

            db.ExecuteQuery(command);
        }