There are some libraries, which are available in their versions written in many different programming languages, like for example Lucene, which is written in Java (as they say, 100% pure Java), but has also its versions in C++, C, Perl, Ruby, Lisp and some other languages. And I'm talking about implementations in these languages, not just FFI interfaces.

Why do people do that? I can see one obvious reason: deployment and distribution (and probably development as well) easier when a project has fewer dependencies. But is there anything else? In what situations is it worth it?


Question: ASP.NET MVC Update part of the model
Answer: I had the same situations with ASP.NET MVC. I used ViewBag's for sending the data in very magical ways, created Javascript strings and ran them with Html.Raw, used .executeSql in many places, done real magic. But after all I asked myself: is it worth the pain?

No matter you don't have enough time (i mean this!), I strongly recommend reading some good documents and try some tutorials before diving into the dark sea of work-arounds.

Don't forget, with a good design and using Model class' features well, you won't need work-arounds too much and this will give you, above all, happiness.

For your situation; the best place is to create a Helper class such as: 

public abstract class Helper&lt;T&gt; : WebViewPage&lt;T&gt;
{
    private dbContext db = new dbContext();

    public virtual whatEver yourUpdateOperation(int? id, string data)
    {
        // you can do your update operations here
        return whatEver;
    }
}


To apply this class to all your WebPages, change the line in your web.config file in your Views directory:

&lt;pages pageBaseType="YourProject.HelperDirectory.Helper"&gt;


From now on you are able to call yourUpdateOperation from your Views such as:

@foreach (var item in Model)
{
&lt;tr&gt;
    &lt;td&gt;
    &lt;!-- View or operate things--&gt;
    &lt;/td&gt;
    @yourUpdateOperation(item.ID, data)
&lt;/tr&gt;
}


Hope this helps.