public int insert(ProductsSuppliersInputModel data) { using (SqlConnection conn = new SqlConnection("Server=192.168.25.111;Database=CRM; User ID=ma;password=123")) { try { var dbParams = new DynamicParameters(); conn.Open(); dbParams.Add("@productsId", Newtonsoft.Json.JsonConvert.SerializeObject(data.ProductsId)); dbParams.Add("@suppliersId", Newtonsoft.Json.JsonConvert.SerializeObject(data.SuppliersId)); var reader = conn.ExecuteReader( sql: "[CRM].[CRM_SP_PARTNERS_PRODUCTS_INSERT]", param: dbParams, commandType: CommandType.StoredProcedure); return(1); } catch (Exception ex) { throw ex; } finally { conn.Close(); } } }
public int delete(ProductsSuppliersInputModel data) { using (SqlConnection conn = new SqlConnection(_configuration.Get("ConnectionString:SQLConnection"))) { try { var dbParams = new DynamicParameters(); conn.Open(); dbParams.Add("@productsId", Newtonsoft.Json.JsonConvert.SerializeObject(data.ProductsId)); dbParams.Add("@suppliersId", Newtonsoft.Json.JsonConvert.SerializeObject(data.SuppliersId)); var reader = conn.ExecuteReader( sql: "[CRM].[CRM_SP_PARTNERS_PRODUCTS_DELETE]", param: dbParams, commandType: CommandType.StoredProcedure); return(1); } catch (Exception ex) { throw ex; } finally { conn.Close(); } } }