<input class="form-control" type="text" name="Name" required>
this.save = function () { //验证不通过返回 if (!_$categoryForm.valid()) { return; }
[Required] public string Name { get; set; }
//if (!_$categoryForm.valid()) { // return; //}
public void CreateCategory(CreateCategoryInput input) { int count=_categoryRepository.Count(a => a.Name.Equals(input.Name)); if (count > 0) { throw new UserFriendlyException("分类名称已存在!"); } _categoryRepository.Insert(new Category() { Name = input.Name }); }
ASP.NET Zero--11.一个例子(4)商品分类管理-数据检验
原文:http://www.cnblogs.com/shensigzs/p/6291033.html