Example #1
0
 public override bool IsValid(object value)
 {
     using (RoomyDbContext db = new RoomyDbContext())
     {
         return(!db.Users.Any(x => x.Email == value.ToString()));
     }
 }
Example #2
0
 public override bool IsValid(object value)
 {
     using (RoomyDbContext db = new RoomyDbContext())
     {
         //var req = db.Users.Where(x => x.Mail == (string)value).SingleOrDefault();
         return(!db.Users.Any(x => x.Mail == value.ToString()));
     }
 }
 protected override ValidationResult IsValid(object value, ValidationContext validationContext)
 {
     using (RoomyDbContext db = new RoomyDbContext())
     {
         var dbProperties = db.GetType().GetProperties();
         foreach (var item in dbProperties)
         {
             if (item.PropertyType.FullName.Contains(validationContext.ObjectType.Name))
             {
                 item.GetValue(db);
             }
         }
     }
     return(null);
 }
Example #4
0
        public override bool IsValid(object value)
        {
            using (RoomyDbContext db = new RoomyDbContext())
            {
                //essaie

                /* if (value is string)
                 * {
                 *   var mail = db.Users.SingleOrDefault(x => x.Mail == (string)value);
                 *   if (mail == null)
                 *   {
                 *   }
                 * }
                 * return false;*/

                //correction
                return(!db.Users.Any(x => x.Mail == value.ToString()));
            }
        }
Example #5
0
 protected override ValidationResult IsValid(object value, ValidationContext validationContext)
 {
     using (RoomyDbContext db = new RoomyDbContext())
     {
         /*var dbProperties = db.GetType().GetProperties();
          *
          * Type t = validationContext.ObjectType;
          *
          * var ds = db.Set(validationContext.ObjectType).
          *
          *  .Any(x => x.test == "test");
          *
          *
          *
          *  if (dbSet.Any(x => x.GetType().GetProperty(validationContext.MemberName).GetValue(x).ToString() == value.ToString()))
          *
          *  return new ValidationResult("La valeur n'existe pas");
          */
     }
     return(ValidationResult.Success);
 }
Example #6
0
 public AuthenticationController(RoomyDbContext db) : base(db)
 {
 }
Example #7
0
 public UsersController(RoomyDbContext db) : base(db)
 {
 }
Example #8
0
 public BaseController(RoomyDbContext db)
 {
     this.db = db;
 }
Example #9
0
 public UsersController(RoomyDbContext db)
 {
     this.db = db;
 }
Example #10
0
 public FooterViewComponent(RoomyDbContext db)
 {
     this.db = db;
 }
Example #11
0
 public CategoriesController(RoomyDbContext context)
 {
     _context = context;
 }
Example #12
0
 public RoomsController(RoomyDbContext context)
 {
     _context = context;
 }