public string Sua(BangGiaInGiaCongBDO entityBDO) { using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(GlobalConfig.CnnString(tenDB))) { var p = new DynamicParameters(); //Của dapper p.Add("@id", entityBDO.Id); p.Add("@Ten", entityBDO.Ten); p.Add("@DienGiai", entityBDO.DienGiai); p.Add("@PhiCaiDat", entityBDO.PhiCaiDat); p.Add("@PhiHaoNVLCaiDat", entityBDO.PhiHaoNVLCaiDat); p.Add("@PhiToiThieu", entityBDO.PhiToiThieu); p.Add("@DaySoLuong", entityBDO.DaySoLuong); p.Add("@DayGia", entityBDO.DayGia); p.Add("@DonViTinh", entityBDO.DonViTinh); p.Add("@ThuTu", entityBDO.ThuTu); p.Add("@KhongSuDung", entityBDO.KhongSuDung); p.Add("@LoaiBangGia", entityBDO.LoaiBangGia); p.Add("@SoLuongBao", entityBDO.SoLuongBao); connection.Execute("dbo.spBangGiaInGiaCong_SuaTheoId", p, commandType: CommandType.StoredProcedure); } return($"Đã sửa {entityBDO.Id}"); }
public string Them(BangGiaInGiaCongBDO entityBDO) { using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(GlobalConfig.CnnString(tenDB))) { var p = new DynamicParameters(); //Của dapper p.Add("@Ten", entityBDO.Ten); p.Add("@DienGiai", entityBDO.DienGiai); p.Add("@PhiCaiDat", entityBDO.PhiCaiDat); p.Add("@PhiHaoNVLCaiDat", entityBDO.PhiHaoNVLCaiDat); p.Add("@PhiToiThieu", entityBDO.PhiToiThieu); p.Add("@DaySoLuong", entityBDO.DaySoLuong); p.Add("@DayGia", entityBDO.DayGia); p.Add("@DonViTinh", entityBDO.DonViTinh); p.Add("@ThuTu", entityBDO.ThuTu); p.Add("@KhongSuDung", entityBDO.KhongSuDung); p.Add("@LoaiBangGia", entityBDO.LoaiBangGia); p.Add("@SoLuongBao", entityBDO.SoLuongBao); p.Add("@id", dbType: DbType.Int32, direction: ParameterDirection.Output); //Excecute connection.Execute("dbo.spBangGiaInGiaCong_Them", p, commandType: CommandType.StoredProcedure); //xử lý id out entityBDO.Id = p.Get <int>("@id"); ///nếu cần có thể ///đặt return ở đay cũng được } return("Đã thêm"); }
public BangGiaInGiaCongBDO DocTheoId(int iD) { BangGiaInGiaCongBDO output = null; using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(GlobalConfig.CnnString(tenDB))) { var p = new DynamicParameters(); p.Add("@id", iD); output = connection.QueryFirstOrDefault <BangGiaInGiaCongBDO>("dbo.spBangGiaInGiaCong_DocTheoId", p, commandType: CommandType.StoredProcedure);//Thử return(output); } }
public string Sua(BangGiaInGiaCongBDO entityBDO) { return(dAO.Sua(entityBDO)); }
public string Them(BangGiaInGiaCongBDO entityBDO) { return(dAO.Them(entityBDO)); }