Q:

Best practice to add list item in SharePoint Server OM?

from the below codes, which one is best practice and performance wise also:-
CASE 1:
using (SPSite oSPsite = new SPSite("http://website url/"))
{
using (SPWeb oSPWeb = oSPsite.OpenWeb())
      {
            oSPWeb.AllowUnsafeUpdates = true;

            // Fetch the List
            SPList list = oSPWeb.Lists["MyList"];

            //Add a new item in the List
            SPListItem itemToAdd = list.Items.Add();
            itemToAdd["Title"] = "Test Title";
            itemToAdd["Description"] = "Test Description";
            itemToAdd.Update();

            // Get the Item ID
            listItemId = itemToAdd.ID;

            // Update the List item by ID
            SPListItem itemToUpdate = list.GetItemById(listItemId);
            itemToUpdate["Description"] = "Changed Description";
            itemToUpdate.Update();

            // Delete List item
            SPListItem itemToDelete = list.GetItemById(listItemId);
            itemToDelete.Delete();

            oSPWeb.AllowUnsafeUpdates = false;
       }
}

Reference: http://www.mindfiresolutions.com/Add-Update-and-Delete-List-Items-Programmatically-in-Sharepoint-372.php
CASE 2:
SPWeb mySite = SPContext.Current.Web;
SPListItemCollection listItems = mySite.Lists[TextBox1.Text].Items;

SPListItem item = listItems.Add();

item["Title"] = TextBox2.Text;
item["Stock"] = Convert.ToInt32(TextBox3.Text);
item["Return Date"] = Convert.ToDateTime(TextBox4.Text);
item["Employee"] = TextBox5.Text;

item.Update();
}

Reference: http://msdn.microsoft.com/en-us/library/office/ms467435(v=office.14).aspx. There is no mention of allow unsafe updates in this code? Is that OK?

A:

AllowUnsafeUpdates=true; is not required to add/delete/update list items unless you are doing these operations in Page_Load or other Get methods. Both CASE 1 and CASE 2 does not look good in terms of best practice.
Problems with both case code:
Do not use oSPWeb.Lists["MyList"]; instead use oSPWeb.Lists.TryGetList("MyList1");
Do not use list.Items.Add(); instead use list.AddItem();
Always dispose objects (Best to use using(), done correctly in case 1, but try to avoid hard coded url if it is a webpart or user control etc)
Add null check for list object before using it.
Best practice code:
using (SPSite oSPsite = new SPSite("http://website url/"))//try not use hard code url unless no other option
            {
                using (SPWeb oSPWeb = oSPsite.OpenWeb())
                {
                    // Fetch the List
                    SPList list = oSPWeb.Lists.TryGetList("MyList1");
                    if (list != null)
                    {
                        //Add a new item in the List
                        SPListItem itemToAdd = list.AddItem();
                        itemToAdd["Title"] = "Test Title";
                        itemToAdd["Description"] = "Test Description";
                        itemToAdd.Update();

                        // Get the Item ID
                        listItemId = itemToAdd.ID;

                        // Update the List item by ID
                        SPListItem itemToUpdate = list.GetItemById(listItemId);
                        itemToUpdate["Description"] = "Changed Description";
                        itemToUpdate.Update();

                        // Delete List item
                        SPListItem itemToDelete = list.GetItemById(listItemId);
                        itemToDelete.Delete();
                    }
                }
            }

Always run sharepoint code analyser on your code.You can download it here

