示例#1
0
        protected override ValidationResult IsValid(object value, ValidationContext validationContext)
        {
            LinkHubDbEntities db = new LinkHubDbEntities();
            int count            = db.tbl_Url.ToList().Where(u => u.Url.Equals(value)).Count();

            if (count != 0 || value == null)
            {
                return(new ValidationResult("Url already exist."));
            }
            return(ValidationResult.Success);
        }
        protected override ValidationResult IsValid(object value, ValidationContext validationContext)
        {
            LinkHubDbEntities db       = new LinkHubDbEntities();
            string            urlValue = value.ToString();
            int count = db.tbl_Url.Where(x => x.Url == urlValue).ToList().Count();

            if (count != 0)
            {
                return(new ValidationResult("Url Already Exist"));
            }
            return(ValidationResult.Success);
        }
示例#3
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);
        }
示例#4
0
        protected override ValidationResult IsValid(object value, ValidationContext validationContext)
        {
            LinkHubDbEntities db         = new LinkHubDbEntities();
            string            emailValue = value.ToString();
            int count = db.tbl_User.Count(x => x.UserEmail.Equals(emailValue));

            if (count != 0)
            {
                return(new ValidationResult("Email already exist."));
            }
            return(ValidationResult.Success);
        }
示例#5
0
 public ActionResult CreateURL(tbl_Url objUrl)
 {
     LinkHubDbEntities db = new LinkHubDbEntities();
     ViewBag.CategoryId = new SelectList(db.tbl_Category, "CategoryId", "CategoryName");
     return View();
 }
示例#6
0
 // GET: URL
 public ActionResult Index()
 {
     LinkHubDbEntities db = new LinkHubDbEntities();
     ViewBag.CategoryId = new SelectList(db.tbl_Category, "CategoryId", "CategoryName");
     return View();
 }
示例#7
0
文件: UserDb.cs 项目: esrshn/LinkHub
 public UserDb()
 {
     db = new LinkHubDbEntities();
 }
示例#8
0
文件: tbl_Url.cs 项目: esrshn/LinkHub
        protected override ValidationResult IsValid(object firstValue, ValidationContext validationContext)
        {
            var firstComparable = firstValue as IComparable;
            var secondComparable = GetSecondComparable(validationContext);

            if (firstComparable != null && secondComparable != null)
            {

                LinkHubDbEntities db = new LinkHubDbEntities();
                string urlValue = firstValue.ToString();
                int urlId = int.Parse(secondComparable.ToString());

                int count = db.tbl_Url.Where(x => x.Url == urlValue && x.UrlId != urlId).ToList().Count();
                if (count != 0)
                    return new ValidationResult("Url Already Exist");
            }

            return ValidationResult.Success;
        }
示例#9
0
 public UrlDb()
 {
     db = new LinkHubDbEntities();
 }
示例#10
0
 public ActionResult Index()
 {
     LinkHubDbEntities db = new LinkHubDbEntities();
     ViewBag.CategoryId = new SelectList(objBs.categoryBs.GetAll().ToList(), "CategoryId", "CategoryName");
     return View();
 }
示例#11
0
 public CategoryDb()
 {
     db = new LinkHubDbEntities();
 }