当前位置: 首页>>代码示例>>C#>>正文


C# DAL.UnitOfWork.Save方法代码示例

本文整理汇总了C#中DAL.UnitOfWork.Save方法的典型用法代码示例。如果您正苦于以下问题:C# DAL.UnitOfWork.Save方法的具体用法?C# DAL.UnitOfWork.Save怎么用?C# DAL.UnitOfWork.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DAL.UnitOfWork的用法示例。


在下文中一共展示了DAL.UnitOfWork.Save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddGroup

        public static Models.ValidationResult AddGroup(Models.Group group, int userId)
        {
            using (var uow = new DAL.UnitOfWork())
            {
                var validationResult = ValidateGroup(group, true);
                if (validationResult.IsValid)
                {
                    uow.GroupRepository.Insert(group);
                    validationResult.IsValid = uow.Save();

                    //If Group management is being used add this group to the allowed users list
                    var userManagedGroups = BLL.UserGroupManagement.Get(userId);
                    if (userManagedGroups.Count > 0)
                        BLL.UserGroupManagement.AddUserGroupManagements(
                            new List<Models.UserGroupManagement>
                            {
                                new Models.UserGroupManagement
                                {
                                    GroupId = group.Id,
                                    UserId = userId
                                }
                            });
                }

                return validationResult;
            }
        }
开发者ID:cdadmin,项目名称:clonedeploy,代码行数:27,代码来源:Group.cs

示例2: AddMembership

        public static bool AddMembership(List<Models.GroupMembership> groupMemberships)
        {
            var group = new Models.Group();
            var result = false;
            using (var uow = new DAL.UnitOfWork())
            {
                foreach (var membership in groupMemberships.Where(membership => !uow.GroupMembershipRepository.Exists(
                    g => g.ComputerId == membership.ComputerId && g.GroupId == membership.GroupId)))
                {
                    uow.GroupMembershipRepository.Insert(membership);
                    group = BLL.Group.GetGroup(membership.GroupId);
                }
                result = uow.Save();
            }

            if (group.SetDefaultProperties == 1)
            {
                var groupProperty = BLL.GroupProperty.GetGroupProperty(group.Id);
                BLL.GroupProperty.UpdateComputerProperties(groupProperty);
            }

            if (group.SetDefaultBootMenu == 1)
            {
                var groupBootMenu = BLL.GroupBootMenu.GetGroupBootMenu(group.Id);
                BLL.GroupBootMenu.UpdateGroupMemberBootMenus(groupBootMenu);
            }

            return result;
        }
开发者ID:cdadmin,项目名称:clonedeploy,代码行数:29,代码来源:GroupMembership.cs

示例3: DeleteGroup

 public static bool DeleteGroup(int groupId)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         uow.UserGroupGroupManagementRepository.DeleteRange(x => x.GroupId == groupId);
         return uow.Save();
     }
 }
开发者ID:cdadmin,项目名称:clonedeploy,代码行数:8,代码来源:UserGroupGroupManagement.cs

示例4: DeleteIncludedManifestFromTemplate

 public static bool DeleteIncludedManifestFromTemplate(int includedManifestId)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         uow.MunkiIncludedManifestRepository.Delete(includedManifestId);
         return uow.Save();
     }
 }
开发者ID:cdadmin,项目名称:clonedeploy,代码行数:8,代码来源:MunkiIncludedManifest.cs

示例5: AddImageProfileScript

 public static bool AddImageProfileScript(Models.ImageProfileScript imageProfileScript)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         uow.ImageProfileScriptRepository.Insert(imageProfileScript);
         return uow.Save();
     }
 }
开发者ID:Terricide,项目名称:clonedeploy,代码行数:8,代码来源:ImageProfileScript.cs

示例6: DeleteManagedUnInstallFromTemplate

 public static bool DeleteManagedUnInstallFromTemplate(int managedUnInstallId)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         uow.MunkiManagedUnInstallRepository.Delete(managedUnInstallId);
         return uow.Save();
     }
 }
开发者ID:cdadmin,项目名称:clonedeploy,代码行数:8,代码来源:MunkiManagedUninstall.cs

示例7: AddImageProfileSysprepTag

 public static bool AddImageProfileSysprepTag(Models.ImageProfileSysprepTag imageProfileSysprepTag)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         uow.ImageProfileSysprepRepository.Insert(imageProfileSysprepTag);
         return uow.Save();
     }
 }
开发者ID:Terricide,项目名称:clonedeploy,代码行数:8,代码来源:ImageProfileSysprepTag.cs

示例8: DeleteUserGroupRights

 public static bool DeleteUserGroupRights(int userGroupId)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         uow.UserGroupRightRepository.DeleteRange(x => x.UserGroupId == userGroupId);
         return uow.Save();
     }
 }
开发者ID:cdadmin,项目名称:clonedeploy,代码行数:8,代码来源:UserGroupRight.cs

示例9: DeleteImage

 public static bool DeleteImage(int imageId)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         uow.ImageProfileRepository.DeleteRange(x => x.ImageId == imageId);
         return uow.Save();
     }
 }
开发者ID:Terricide,项目名称:clonedeploy,代码行数:8,代码来源:ImageProfile.cs

示例10: DeleteAll

 public static void DeleteAll()
 {
     using (var uow = new DAL.UnitOfWork())
     {
         uow.ActiveImagingTaskRepository.DeleteRange();
         uow.Save();
     }
 }
开发者ID:cdadmin,项目名称:clonedeploy,代码行数:8,代码来源:ActiveImagingTask.cs

示例11: DeleteForMulticast

 public static void DeleteForMulticast(int multicastId)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         uow.ActiveImagingTaskRepository.DeleteRange(t => t.MulticastId == multicastId);
         uow.Save();
     }
 }
开发者ID:cdadmin,项目名称:clonedeploy,代码行数:8,代码来源:ActiveImagingTask.cs

示例12: DeleteImage

 public static bool DeleteImage(int imageId)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         uow.UserGroupImageManagementRepository.DeleteRange(x => x.ImageId == imageId);
         return uow.Save();
     }
 }
开发者ID:cdadmin,项目名称:clonedeploy,代码行数:8,代码来源:UserGroupImageManagement.cs

示例13: AddActiveImagingTask

 public static bool AddActiveImagingTask(Models.ActiveImagingTask activeImagingTask)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         uow.ActiveImagingTaskRepository.Insert(activeImagingTask);
         return uow.Save();
     }
 }
开发者ID:cdadmin,项目名称:clonedeploy,代码行数:8,代码来源:ActiveImagingTask.cs

示例14: DeleteGroup

 public static bool DeleteGroup(int groupId)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         uow.GroupPropertyRepository.DeleteRange(x => x.GroupId == groupId);
         return uow.Save();
     }
 }
开发者ID:Terricide,项目名称:clonedeploy,代码行数:8,代码来源:GroupProperty.cs

示例15: DeleteRoom

 public static bool DeleteRoom(int roomId)
 {
     using (var uow = new DAL.UnitOfWork())
     {
         uow.RoomRepository.Delete(roomId);
         return uow.Save();
     }
 }
开发者ID:Terricide,项目名称:clonedeploy,代码行数:8,代码来源:Room.cs


注:本文中的DAL.UnitOfWork.Save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。