本文整理汇总了C#中UserModel.LoadDropDowns方法的典型用法代码示例。如果您正苦于以下问题:C# UserModel.LoadDropDowns方法的具体用法?C# UserModel.LoadDropDowns怎么用?C# UserModel.LoadDropDowns使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserModel
的用法示例。
在下文中一共展示了UserModel.LoadDropDowns方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegisterDonor
public ActionResult RegisterDonor(UserModel newDonor)
{
if (ViewData.ModelState.IsValid)
{
newDonor.Save();
newDonor.ProcessingStatus = true;
return View(@"~\Views\RegisterDonor.cshtml", newDonor);
}
newDonor.LoadDropDowns();
return View(@"~\Views\RegisterDonor.cshtml", newDonor);
}
示例2: SearchDonor
public ActionResult SearchDonor(UserModel userModel)
{
userModel.SearchDonor(model => model.IsVolunteer == false);
userModel.LoadDropDowns();
return View(@"~\Views\DonorList.cshtml", userModel);
}
示例3: SearchVolunteer
public ActionResult SearchVolunteer(UserModel volunteerModel)
{
volunteerModel.SearchVolunteer(model => model.IsVolunteer == true);
volunteerModel.LoadDropDowns();
return View(@"~\Views\VolunteerList.cshtml", volunteerModel);
}
示例4: BindModel
//.........这里部分代码省略.........
var landlineNumber = request.Form.Get(FormElement.LandlineNumber.ToString());
var email = request.Form.Get(FormElement.Email.ToString());
var agreed = request.Form.Get(FormElement.checkbox.ToString()) == "checkbox" ? true : false;
if (string.IsNullOrWhiteSpace(firstName))
{
bindingContext.ModelState.AddModelError(bindingContext.ModelName, "First Name is required.");
}
if (string.IsNullOrWhiteSpace(lastName))
{
bindingContext.ModelState.AddModelError(bindingContext.ModelName, "Last Name is required.");
}
if (genderId == null)
{
bindingContext.ModelState.AddModelError(bindingContext.ModelName, "Gender is required.");
}
var dateOfBirthRaw = string.Format("{0}/{1}/{2}", monthOfBirth.Value, dayOfBirth, yearOfBirth);
var dateOfBirth = DateTime.MinValue;
if (DateTime.TryParse(dateOfBirthRaw, out dateOfBirth) && dateOfBirth > DateTime.Now.AddYears(-17))
{
bindingContext.ModelState.AddModelError(bindingContext.ModelName, "Date of Birth is not valid.");
}
if (bloodGroupId == null || bloodGroupId == 0)
{
bindingContext.ModelState.AddModelError(bindingContext.ModelName, "Blood Group is required");
}
if (weightId == null || weightId == 0)
{
bindingContext.ModelState.AddModelError(bindingContext.ModelName, "Weight is required");
}
if (string.IsNullOrWhiteSpace(mobileNumber1))
{
bindingContext.ModelState.AddModelError(bindingContext.ModelName, "Mobile Number is required");
}
if (string.IsNullOrWhiteSpace(address))
{
bindingContext.ModelState.AddModelError(bindingContext.ModelName, "Address is required");
}
if (countryId == null || countryId == 0)
{
bindingContext.ModelState.AddModelError(bindingContext.ModelName, "Country is required.");
}
if (stateId == null || stateId == 0)
{
bindingContext.ModelState.AddModelError(bindingContext.ModelName, "State is required");
}
if (districtId == null || districtId == 0)
{
bindingContext.ModelState.AddModelError(bindingContext.ModelName, "District is required");
}
if (townId == null || townId == 0)
{
bindingContext.ModelState.AddModelError(bindingContext.ModelName, "Town is required");
}
if (!agreed)
{
bindingContext.ModelState.AddModelError(bindingContext.ModelName, "Please check the check box if you have checked your eligibility and you are willing to donate your blood.");
}
UserModel userModel = new UserModel
{
UserId = userId != null ? userId.Value : 0,
WebSiteId = webSiteId != null ? webSiteId.Value : 0,
FirstName = firstName,
LastName = lastName,
GenderId = genderId,
DayOfBirth = dayOfBirth != null ? dayOfBirth.Value : 0,
MonthOfBirth = monthOfBirth != null ? monthOfBirth.Value : 0,
YearOfBirth = yearOfBirth != null ? yearOfBirth.Value : 0,
DateOfBirth = dateOfBirth,
LandlineAreaCode = landlineAreaCode,
Address = address,
PinCode = pinCode,
CountryId = countryId != null ? countryId.Value : 0,
StateId = stateId != null ? stateId.Value : 0,
DistrictId = districtId != null ? districtId.Value : 0,
TownId = townId,
BloodGroupId = bloodGroupId != null ? bloodGroupId.Value : 0,
WeightId = weightId,
MobileNumber1 = !string.IsNullOrWhiteSpace(mobileNumber1) ? mobileNumber1 : string.Empty,
MobileNumber2 = !string.IsNullOrWhiteSpace(mobileNumber2) ? mobileNumber2 : string.Empty,
LandlineNumber = !string.IsNullOrWhiteSpace(landlineNumber) ? landlineNumber : string.Empty,
Email = email,
};
userModel.LoadDropDowns();
return userModel;
}