示例#1
0
 public BaseOperation()
 {
     tbl_CategoryDAL = new tbl_CategoryDAL();
     tbl_UserDAL     = new tbl_UserDAL();
     tbl_UrlDAL      = new tbl_UrlDAL();
     db = Utility.DbContextFactory.CreateSingleDbcontext() as LinkHubDBEntities;
 }
示例#2
0
 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);
        }
示例#4
0
        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);
        }
示例#5
0
 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");
     }
 }
示例#6
0
        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"));
            }
        }
示例#7
0
文件: Userdb.cs 项目: SaifAsad/urlbay
 public Userdb()
 {
     db = new LinkHubDBEntities();
 }
示例#8
0
 public Categorydb()
 {
     db = new LinkHubDBEntities();
 }
示例#9
0
文件: URLdb.cs 项目: SaifAsad/urlbay
 public URLdb()
 {
     db = new LinkHubDBEntities();
 }
示例#10
0
文件: URLdb.cs 项目: SaifAsad/urlbay
 public URLdb()
 {
     db = new LinkHubDBEntities();
 }
示例#11
0
 public Categorydb()
 {
     db = new LinkHubDBEntities();
 }
示例#12
0
文件: Userdb.cs 项目: SaifAsad/urlbay
 public Userdb()
 {
     db = new LinkHubDBEntities();
 }