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);
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #5
0
 public ActionResult CreateURL(tbl_Url objUrl)
 {
     LinkHubDbEntities db = new LinkHubDbEntities();
     ViewBag.CategoryId = new SelectList(db.tbl_Category, "CategoryId", "CategoryName");
     return View();
 }
Beispiel #6
0
 // GET: URL
 public ActionResult Index()
 {
     LinkHubDbEntities db = new LinkHubDbEntities();
     ViewBag.CategoryId = new SelectList(db.tbl_Category, "CategoryId", "CategoryName");
     return View();
 }
Beispiel #7
0
 public UserDb()
 {
     db = new LinkHubDbEntities();
 }
Beispiel #8
0
        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;
        }
Beispiel #9
0
 public UrlDb()
 {
     db = new LinkHubDbEntities();
 }
Beispiel #10
0
 public ActionResult Index()
 {
     LinkHubDbEntities db = new LinkHubDbEntities();
     ViewBag.CategoryId = new SelectList(objBs.categoryBs.GetAll().ToList(), "CategoryId", "CategoryName");
     return View();
 }
Beispiel #11
0
 public CategoryDb()
 {
     db = new LinkHubDbEntities();
 }