MVC 3.0 Remote Validata

 http://deanhume.com/Home/BlogPost/mvc-3-and-remote-validation/51     <---- 
http://davidhayden.com/blog/dave/archive/2011/01/04/ASPNETMVC3RemoteValidationTutorial.aspx   <----
http://www.cnblogs.com/serafin/archive/2011/01/25/1944848.html
html

public ActionResult CheckUserAccountExists( string UserAccount)
{
     string [] existsUsers = { "youguanbumen" , "wodanwojun" };
     bool exists = string .IsNullOrEmpty(existsUsers.FirstOrDefault(u => u.ToLower() == UserAccount.ToLower())) == false ;
     return Json(!exists, JsonRequestBehavior.AllowGet);
}
-------------------------------------------------------------------------------
public ActionResult TagExists(string Name) { var tag = TagRepository.FindAll().Where(i => i.Name == Name).Count(); return Json(tag==0, JsonRequestBehavior.AllowGet); }
相關文章
相關標籤/搜索