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