Exemple #1
0
        public async Task <int> ThemMoiKhoa(Khoa khoa)
        {
            using (Data.Connection())
            {
                var    insertId = 0;
                string Query    = "INSERT INTO Khoa VALUES(@tenKhoa)";
                var    pa       = new DynamicParameters();
                pa.Add("@tenKhoa", khoa.tenKhoa);
                CommandType c = CommandType.Text;
                insertId = await Data.Connection().ExecuteAsync(Query, pa, null, null, c);

                return(insertId);
            }
        }
Exemple #2
0
        public async Task <int> SuaKhoa(Khoa khoa)
        {
            using (Data.Connection())
            {
                var    updateId = 0;
                string Query    = "UPDATE Khoa SET tenKhoa = @tenKhoa WHERE Id = @Id";
                var    pa       = new DynamicParameters();
                pa.Add("@Id", khoa.Id);
                pa.Add("@tenKhoa", khoa.tenKhoa);
                CommandType c = CommandType.Text;
                updateId = await Data.Connection().ExecuteAsync(Query, pa, null, null, c);

                return(updateId);
            }
        }