public IEnumerable <AlbumDto> ConvertInAlbumDtoList(IEnumerable <Wall> walls) { List <AlbumDto> albums = new List <AlbumDto>(); AjaxMinExtensions.ForEach(walls, w => albums.Add(GetAlbumDto(w))); return(albums); }
public void Login(string redirectUrl) { if (!Request.IsAuthenticated) { HttpContext.GetOwinContext().Authentication.Challenge(); return; } if (AjaxMinExtensions.IsNullOrWhiteSpace(redirectUrl)) { redirectUrl = "/"; } Response.Redirect(redirectUrl); }
public ActionResult ClassProperty() { var cell = new MyClassA(); var result = new StringBuilder(); var properties = cell.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance); AjaxMinExtensions.ForEach(properties, prop => { result.Append("<br />"); result.Append($"{prop.Name} {prop.PropertyType} {prop.GetType().IsClass}"); result.Append("<br />"); result.Append($"{prop.PropertyType}"); result.Append("<br />"); result.Append($"{prop.PropertyType.HasElementType}"); result.Append("<br />"); result.Append($"{prop.PropertyType.IsClass}"); }); return(Content($"{result.ToString()}")); }
public ValidateResult Validate(BaseCaseViewModel target) { var result = new ValidateResult(); // 验证抵押物 if (target.Collateral == null || target.Collateral.All(x => x.CollateralType != "-FacilityCategary-MainFacility")) { result.Add(new ErrorMessage() { Key = "Collateral", Message = "房产信息 - 抵押物 不能为空" }); } if (target.Collateral != null && target.Collateral.Any()) { target.Collateral.ForEach(p => result.Add(CollateraValidator.Validate(p).GetErrors())); } //验证配偶唯一性 if (target.RelationPerson.IsNotNull()) { if (target.RelationPerson.Count(p => p.RelationType.Equals(DictionaryType.PersonType.JieKuanRenPeiOu)) > 1) { result.Add(new ErrorMessage("RelationPerson", "借款人配偶只能添加一位")); } } // 借款人 //if (target.BorrowerPerson == null) //{ // result.Add(new ErrorMessage() // { // Key = "RelationPerson", // Message = "借款人 不能为空" // }); //} //借款人证件号 //if (target.BorrowerPerson != null && target.BorrowerPerson.IdentificationNumber != null) //{ // if (target.BorrowerPerson.IdentificationType == DictionaryType.DocType.IdCard) // { // var idCardValidator = new IdCardValidator().Validate(target.BorrowerPerson.IdentificationNumber); // if (idCardValidator.IsNotValid()) // { // result.Add(new ErrorMessage("IdentificationNumber", target.BorrowerPerson.Name + " 身份证号码不正确")); // } // } //} //关系人信息验证身份证号码 if (target.RelationPerson != null) { foreach (var item in target.RelationPerson) { if (item.IdentificationType == "-DocType-IDCard") { var idCardValidateResult = new IdCardValidator().Validate(item.IdentificationNumber); if (idCardValidateResult.IsNotValid()) { result.Add(new ErrorMessage("IdentificationNumber", item.Name + " 身份证号码不正确")); } } } } //单身需要上传婚姻证明 //Extensions.IfNotNull(target.BorrowerPerson, p => //{ // if (p.MaritalStatus != null && p.MaritalStatus != "-MaritalStatus-Unmarried") // { // if (p.MarryFile == null) // { // result.Add(new ErrorMessage("MaritalStatus", p.Name + "需要上传婚姻证明")); // } // } //}); //验证年利率 if (target.AnnualRate == null) { result.Add(new ErrorMessage("AnnualRate", "年化利率不能为空")); } AjaxMinExtensions.IfNotNull(target.AnnualRate, p => { if (p < 2 || p > 100) { result.Add(new ErrorMessage("AnnualRate", "年化利率必须在2-100之间")); } }); return(result); }