//INSERT- UPDATE - DELETE 
        public int Insert(string UserId, string TypeName, string TypeExt, string TypePath, string Description, string Status)
        {
            using (MediaEntities dbContext = new MediaEntities())
            {
                dbContext.CommandTimeout = Settings.CommandTimeout;
                System.Nullable<Int32> ListOrder = (from u in dbContext.Media_Types select u.TypeId).DefaultIfEmpty(0).Max() + 1;

                Media_Types type_obj = new Media_Types();
                type_obj.TypeName = TypeName;
                type_obj.TypeExt = TypeExt;
                type_obj.TypePath = TypePath;
                type_obj.Description = Description;
                type_obj.CreatedByUserId = new Guid(UserId);
                type_obj.CreatedOnDate = System.DateTime.Now;                
                type_obj.IPLog = IP;
                type_obj.ListOrder = (ListOrder == null ? 1 : ListOrder);
                type_obj.Status = Status;
                dbContext.AddToMedia_Types(type_obj);
                int i  = dbContext.SaveChanges();
                return i;
            }
        }
 /// <summary>
 /// Create a new Media_Types object.
 /// </summary>
 /// <param name="typeId">Initial value of the TypeId property.</param>
 /// <param name="typeName">Initial value of the TypeName property.</param>
 public static Media_Types CreateMedia_Types(global::System.Int32 typeId, global::System.String typeName)
 {
     Media_Types media_Types = new Media_Types();
     media_Types.TypeId = typeId;
     media_Types.TypeName = typeName;
     return media_Types;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Media_Types EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToMedia_Types(Media_Types media_Types)
 {
     base.AddObject("Media_Types", media_Types);
 }