虽然我进行数据注释不起作用

时间:2019-06-16 12:41:57

标签: c# asp.net-mvc data-annotations

public ActionResult Registration(RegistrationViewModel registrationViewModel)
{

    var notConfirmedUser = new NotConfirmedUser()
    {
        Name = registrationViewModel.Name,
        Surname = registrationViewModel.Surname,
        Email = registrationViewModel.Email,
        CreateDate = DateTime.Now,
        Password = AccountHelper.GetHash256ByString(registrationViewModel.Password + AccountHelper.AuthSecret),
        ConfirmationCode = AccountHelper.RandomString(),
        RequestIp = Request.UserHostAddress
    };
    db.NotConfirmedUsers.InsertOnSubmit(notConfirmedUser);
    db.SubmitChanges(); //////
    ModelState.Clear();  ///////
    return View();

0 个答案:

没有答案