public override bool IsValid(object value) { using (RoomyDbContext db = new RoomyDbContext()) { return(!db.Users.Any(x => x.Email == value.ToString())); } }
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); }
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())); } }
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); }
public AuthenticationController(RoomyDbContext db) : base(db) { }
public UsersController(RoomyDbContext db) : base(db) { }
public BaseController(RoomyDbContext db) { this.db = db; }
public UsersController(RoomyDbContext db) { this.db = db; }
public FooterViewComponent(RoomyDbContext db) { this.db = db; }
public CategoriesController(RoomyDbContext context) { _context = context; }
public RoomsController(RoomyDbContext context) { _context = context; }