public Task <ResultOfUpdate> Update(string userRoleId, UserRole userRole)
        {
            var foundUserRole = _userRoles.Single(ur => ur.Id == userRoleId);
            var success       = _userRoles.Remove(foundUserRole);

            if (success)
            {
                _userRoles.Add(userRole.Clone());
                return(Task.FromResult(ResultOfUpdate.Updated));
            }
            return(Task.FromResult(ResultOfUpdate.NotFound));
        }
Exemplo n.º 2
0
 private void GenerateUserRoles()
 {
     UserRoleDataBaseFiller.Clone(new UserRole {
         Role = Role.DataBaseFiller, Name = "DataBaseFiller"
     });
     UserRoleAdmin.Clone(new UserRole {
         Role = Role.Admin, Name = "Администратор"
     });
     UserRoleSalesManager.Clone(new UserRole {
         Role = Role.SalesManager, Name = "Менеджер"
     });
     UserRoleEconomist.Clone(new UserRole {
         Role = Role.Economist, Name = "Экономист"
     });
     UserRolePricer.Clone(new UserRole {
         Role = Role.Pricer, Name = "Расчетчик"
     });
     UserRoleDirector.Clone(new UserRole {
         Role = Role.Director, Name = "Директор"
     });
     UserRolePlanMaker.Clone(new UserRole {
         Role = Role.PlanMaker, Name = "Плановик"
     });
     UserRoleConstructor.Clone(new UserRole {
         Role = Role.Constructor, Name = "Конструктор"
     });
     UserRoleReportMaker.Clone(new UserRole {
         Role = Role.ReportMaker, Name = "Отчетчик"
     });
     UserRoleSupplier.Clone(new UserRole {
         Role = Role.Supplier, Name = "Снабженец"
     });
     UserRoleBackManager.Clone(new UserRole {
         Role = Role.BackManager, Name = "BackManager"
     });
     UserRoleBackManagerBoss.Clone(new UserRole {
         Role = Role.BackManagerBoss, Name = "BackManagerBoss"
     });
 }
 public Task <UserRole> Create(UserRole userRole)
 {
     userRole.Id = Guid.NewGuid().ToString();
     _userRoles.Add(userRole.Clone());
     return(Task.FromResult(userRole.Clone()));
 }