Ejemplo n.º 1
0
        public static void ValidateApplicationRole(
            this IFeelGoodSalonIdentityContext dbContext,
            DbEntityValidationResult result)
        {
            var entity = result.Entry.Entity as SalonRole;

            if (entity == null)
            {
                return;
            }

            SalonRole temp = dbContext
                             .Roles.FirstOrDefault(x => x.Name == entity.Name);

            if ((temp != null) && (temp.Id != entity.Id))
            {
                result.ValidationErrors.Add(
                    new DbValidationError("Name", String.Format("A role with name {0} is already registered.", entity.Name)));
            }
        }
Ejemplo n.º 2
0
        public static void ValidateApplicationUser(
            this IFeelGoodSalonIdentityContext dbContext,
            DbEntityValidationResult result)
        {
            var entity = result.Entry.Entity as SalonUser;

            if (entity == null)
            {
                return;
            }

            SalonUser temp = dbContext
                             .Users.FirstOrDefault(x => x.UserName == entity.UserName);

            if ((temp != null) && (temp.Id != entity.Id))
            {
                result.ValidationErrors.Add(
                    new DbValidationError(
                        // A {0} with the {1} of '{2}' is already registered ({3})
                        "UserName",
                        String.Format("An user with user-name {0} is already registered.", entity.UserName)));
            }
        }
Ejemplo n.º 3
0
 public SalonRoleStore(IFeelGoodSalonIdentityContext context)
     : base(context)
 {
 }