本文整理汇总了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;
}
}
示例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;
}
示例3: DeleteGroup
public static bool DeleteGroup(int groupId)
{
using (var uow = new DAL.UnitOfWork())
{
uow.UserGroupGroupManagementRepository.DeleteRange(x => x.GroupId == groupId);
return uow.Save();
}
}
示例4: DeleteIncludedManifestFromTemplate
public static bool DeleteIncludedManifestFromTemplate(int includedManifestId)
{
using (var uow = new DAL.UnitOfWork())
{
uow.MunkiIncludedManifestRepository.Delete(includedManifestId);
return uow.Save();
}
}
示例5: AddImageProfileScript
public static bool AddImageProfileScript(Models.ImageProfileScript imageProfileScript)
{
using (var uow = new DAL.UnitOfWork())
{
uow.ImageProfileScriptRepository.Insert(imageProfileScript);
return uow.Save();
}
}
示例6: DeleteManagedUnInstallFromTemplate
public static bool DeleteManagedUnInstallFromTemplate(int managedUnInstallId)
{
using (var uow = new DAL.UnitOfWork())
{
uow.MunkiManagedUnInstallRepository.Delete(managedUnInstallId);
return uow.Save();
}
}
示例7: AddImageProfileSysprepTag
public static bool AddImageProfileSysprepTag(Models.ImageProfileSysprepTag imageProfileSysprepTag)
{
using (var uow = new DAL.UnitOfWork())
{
uow.ImageProfileSysprepRepository.Insert(imageProfileSysprepTag);
return uow.Save();
}
}
示例8: DeleteUserGroupRights
public static bool DeleteUserGroupRights(int userGroupId)
{
using (var uow = new DAL.UnitOfWork())
{
uow.UserGroupRightRepository.DeleteRange(x => x.UserGroupId == userGroupId);
return uow.Save();
}
}
示例9: DeleteImage
public static bool DeleteImage(int imageId)
{
using (var uow = new DAL.UnitOfWork())
{
uow.ImageProfileRepository.DeleteRange(x => x.ImageId == imageId);
return uow.Save();
}
}
示例10: DeleteAll
public static void DeleteAll()
{
using (var uow = new DAL.UnitOfWork())
{
uow.ActiveImagingTaskRepository.DeleteRange();
uow.Save();
}
}
示例11: DeleteForMulticast
public static void DeleteForMulticast(int multicastId)
{
using (var uow = new DAL.UnitOfWork())
{
uow.ActiveImagingTaskRepository.DeleteRange(t => t.MulticastId == multicastId);
uow.Save();
}
}
示例12: DeleteImage
public static bool DeleteImage(int imageId)
{
using (var uow = new DAL.UnitOfWork())
{
uow.UserGroupImageManagementRepository.DeleteRange(x => x.ImageId == imageId);
return uow.Save();
}
}
示例13: AddActiveImagingTask
public static bool AddActiveImagingTask(Models.ActiveImagingTask activeImagingTask)
{
using (var uow = new DAL.UnitOfWork())
{
uow.ActiveImagingTaskRepository.Insert(activeImagingTask);
return uow.Save();
}
}
示例14: DeleteGroup
public static bool DeleteGroup(int groupId)
{
using (var uow = new DAL.UnitOfWork())
{
uow.GroupPropertyRepository.DeleteRange(x => x.GroupId == groupId);
return uow.Save();
}
}
示例15: DeleteRoom
public static bool DeleteRoom(int roomId)
{
using (var uow = new DAL.UnitOfWork())
{
uow.RoomRepository.Delete(roomId);
return uow.Save();
}
}