Example #1
0
        //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);
            }
        }