If I send a link to my website to someone, and they click the link, I want to record that they clicked the link.
So my idea is: If I add a parameter to the link, like ?customer=100101 - how can I register the value 100101 in a file or database?
Further how to write CRUD operation using scopeprovider is detailed below.
Hope this helps.
using Umbraco.Core.Scoping;
namespace My.Website
public class DatabaseExample
{
private IScopeProvider _scopeProvider;
public DatabaseExample(IScopeProvider scopeProvider)
{
_scopeProvider = scopeProvider;
}
public void DoSomething()
{
using (var scope = _scopeProvider.CreateScope())
{
// Scope.Database has what you need/want
scope.Database.Fetch<BlogComment>("Select * From tblBlogComment");
// You must always complete a scope
scope.Complete();
}
}
public void DoInsert(BlogComment comment)
{
using (var scope = _scopeProvider.CreateScope())
{
// Scope.Database has what you need/want
scope.Database.Insert(comment);
// You must always complete a scope
scope.Complete();
}
}
}
}
Save parameter
If I send a link to my website to someone, and they click the link, I want to record that they clicked the link. So my idea is: If I add a parameter to the link, like ?customer=100101 - how can I register the value 100101 in a file or database?
You can create your Custom Table and store the value.
Code to create custom table https://our.umbraco.com/documentation/Extending/Database/
Further how to write CRUD operation using scopeprovider is detailed below.
Hope this helps.
Cheers,
Shaishav
is working on a reply...