/// <summary> /// Update role /// </summary> /// <param name="e">Role with updated info</param> public async Task Update(BllRole e) { if (e == null) { throw new ArgumentNullException(nameof(e)); } await context.RoleStore.UpdateAsync(e.ToDalRole()); }
public void Update(BllRole entity) { if (entity == null) { return; } UnitOfWork?.RoleRepository?.Update(entity.ToDalRole()); UnitOfWork?.Commit(); }
/// <summary> /// Create new role /// </summary> /// <param name="e">Role to create</param> /// <returns>Id of the created role</returns> public async Task <int> Create(BllRole e) { if (e == null || string.IsNullOrEmpty(e.Name)) { throw new ArgumentNullException(nameof(e)); } await context.RoleStore.CreateAsync(e.ToDalRole()); return((await context.RoleStore.FindByNameAsync(e.Name)).Id); }
/// <summary> /// Creates new Role. /// </summary> /// <param name="role"> Role to create.</param> public void CreateRole(BllRole role) { if (role == null) { throw new ArgumentNullException(nameof(role)); } if (repository.GetByPredicate(r => r.Name == role.Name).Count() > 0) { throw new RoleAlreadyExistsException(nameof(role)); } repository.Create(role.ToDalRole()); service.Save(); }
/// <summary> /// Updates the role /// </summary> /// <param name="entity">Role</param> public void Update(BllRole entity) { roleRepository.Update(entity.ToDalRole()); unitOfWork.Commit(); }
/// <summary> /// create new role entity /// </summary> /// <param name="role">role entity on BLL</param> public void CreateRole(BllRole role) { roleRepository.Create(role.ToDalRole()); uow.Commit(); }