Пример #1
0
        public async Task <int> ThemMoiLop(Lop lop)
        {
            using (Data.Connection())
            {
                var    insertId = 0;
                string Query    = "INSERT INTO Lop VALUES(@TenLop,@KhoaId)";
                var    pa       = new DynamicParameters();
                pa.Add("@TenLop", lop.TenLop);
                pa.Add("@KhoaId", lop.khoaId);
                CommandType c = CommandType.Text;
                insertId = await Data.Connection().ExecuteAsync(Query, pa, null, null, c);

                return(insertId);
            }
        }
Пример #2
0
        public async Task <int> SuaLop(Lop lop)
        {
            using (Data.Connection())
            {
                var    updateId = 0;
                string Query    = "UPDATE Lop SET TenLop = @tenLop, KhoaId = @KhoaId WHERE Id = @Id";
                var    pa       = new DynamicParameters();
                pa.Add("@Id", lop.Id);
                pa.Add("@tenLop", lop.TenLop);
                pa.Add("@KhoaId", lop.khoaId);
                CommandType c = CommandType.Text;
                updateId = await Data.Connection().ExecuteAsync(Query, pa, null, null, c);

                return(updateId);
            }
        }