public BaseOperation() { tbl_CategoryDAL = new tbl_CategoryDAL(); tbl_UserDAL = new tbl_UserDAL(); tbl_UrlDAL = new tbl_UrlDAL(); db = Utility.DbContextFactory.CreateSingleDbcontext() as LinkHubDBEntities; }
protected override ValidationResult IsValid(object value, ValidationContext validationContext) { LinkHubDBEntities db = new LinkHubDBEntities(); string userEmailValue = value.ToString(); int count = db.tbl_User.Where(x => x.UserEmail == userEmailValue).ToList().Count(); if (count != 0) return new ValidationResult("User Already Exist With This Email ID"); return ValidationResult.Success; }
public static DbContext CreateSingleDbcontext() { DbContext dbcontext = (DbContext)CallContext.GetData("dbcontext"); if (dbcontext == null) { dbcontext = new LinkHubDBEntities(); CallContext.SetData("dbcontext", dbcontext); } return(dbcontext); }
protected override ValidationResult IsValid(object value, ValidationContext validationContext) { LinkHubDBEntities db = new LinkHubDBEntities(); string userEmailValue = value.ToString(); int count = db.tbl_User.Where(x => x.UserEmail == userEmailValue).ToList().Count(); if (count != 0) { return(new ValidationResult("User Already Exist With This Email ID")); } return(ValidationResult.Success); }
protected override ValidationResult IsValid(object value, ValidationContext validationContext) { LinkHubDBEntities db = new LinkHubDBEntities(); if (value != null) { string urlValue = value.ToString(); //look for the value in the database, if found update count int count = db.tbl_Url.Where(x => x.Url == urlValue).ToList().Count(); if (count != 0) return new ValidationResult("Url Already Exist"); return ValidationResult.Success; } else { return new ValidationResult("Please fill in the required fields"); } }
protected override ValidationResult IsValid(object value, ValidationContext validationContext) { LinkHubDBEntities db = new LinkHubDBEntities(); if (value != null) { string urlValue = value.ToString(); //look for the value in the database, if found update count int count = db.tbl_Url.Where(x => x.Url == urlValue).ToList().Count(); if (count != 0) { return(new ValidationResult("Url Already Exist")); } return(ValidationResult.Success); } else { return(new ValidationResult("Please fill in the required fields")); } }
public Userdb() { db = new LinkHubDBEntities(); }
public Categorydb() { db = new LinkHubDBEntities(); }
public URLdb() { db = new LinkHubDBEntities(); }
public URLdb() { db = new LinkHubDBEntities(); }
public Categorydb() { db = new LinkHubDBEntities(); }
public Userdb() { db = new LinkHubDBEntities(); }