示例#1
0
        // POST absente/values
        public void Post([FromBody] Absente data)
        {
            DatabaseOperations db      = new DatabaseOperations();
            MySqlCommand       command = new MySqlCommand("INSERT INTO Absente(ClasseId,  StudentId,  TeacherId,  Date,  CreationTime) VALUES(@ClasseId,  @StudentId,  @TeacherId,  @Date,  @CreationTime)");

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

            db.ExecuteQuery(command);
        }
示例#2
0
        public static async Task <Absente> AddAbsente(Absente absente)
        {
            string data;

            data = "";

            try
            {
                data = await HttpRequestClient.PostRequest("Absente.php?cmd=addAbsente", absente);

                absente = JsonConvert.DeserializeObject <Absente>(data);
            }
            catch (Exception ee)
            {
                Console.WriteLine(ee.Message);
            }

            return(absente);
        }