Exemplo n.º 1
0
        ////INSERT- UPDATE - DELETE
        public int Insert(int PortalId, int ContentItemId, string CultureCode, string RouteName, string RouteUrl, string PhysicalFile,
                          bool CheckPhysicalUrlAccess, string RouteValueDictionary, string Description, bool Discontinued)
        {
            int returnValue = 0;

            using (CommonEntities dbContext = new CommonEntities())
            {
                using (System.Transactions.TransactionScope transcope = new System.Transactions.TransactionScope())
                {
                    int           ListOrder = (from u in dbContext.aspnet_Routes select u.ListOrder).DefaultIfEmpty(0).Max() + 1;
                    aspnet_Routes entity    = new aspnet_Routes();
                    entity.PortalId               = PortalId;
                    entity.ContentItemId          = ContentItemId;
                    entity.CultureCode            = CultureCode;
                    entity.RouteName              = RouteName;
                    entity.RouteUrl               = RouteUrl;
                    entity.PhysicalFile           = PhysicalFile;
                    entity.CheckPhysicalUrlAccess = CheckPhysicalUrlAccess;
                    entity.RouteValueDictionary   = RouteValueDictionary;
                    entity.Description            = Description;
                    entity.ListOrder              = ListOrder;
                    entity.Discontinued           = Discontinued;
                    dbContext.AddToaspnet_Routes(entity);
                    returnValue = dbContext.SaveChanges();
                    dbContext.Connection.Close();
                    transcope.Complete();
                }
            }
            return(returnValue);
        }