{"id":176023,"date":"2013-04-09T22:56:08","date_gmt":"2013-04-09T18:56:08","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=176023"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=176023","title":{"rendered":"<span class=\"post_title\">ASP.NET MVC \u0423\u0440\u043e\u043a 5. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0411\u0414<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t<b>\u0426\u0435\u043b\u044c \u0443\u0440\u043e\u043a\u0430.<\/b> \u041e\u0442\u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0432\u0435\u0441\u044c \u043f\u0443\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0411\u0414 \u0438 \u0432\u044b\u0432\u043e\u0434\u0430 \u0435\u0433\u043e. \u0412\u044b\u0432\u043e\u0434 \u043e\u0448\u0438\u0431\u043e\u043a. \u0412\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f. \u041c\u0430\u043f\u043f\u0435\u0440\u044b. \u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438. \u041a\u0430\u043f\u0447\u0430. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0411\u0414. <\/p>\n<h5>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h5>\n<p>  \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0432\u0430\u0436\u043d\u044b\u0445 \u0443\u0440\u043e\u043a\u043e\u0432, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043d\u043e \u043f\u0440\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. \u041b\u044e\u0431\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435, \u043e\u0442 \u0441\u043b\u043e\u0436\u043d\u044b\u0445, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u0443\u044e \u0430\u043d\u043a\u0435\u0442\u0443, \u0434\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u0445, \u043a\u043e\u0433\u0434\u0430 \u0441\u0442\u0430\u0432\u0438\u043c \u043b\u0430\u0439\u043a, \u2013 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:  <\/p>\n<ul>\n<li>Post\\get \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0441\u0430\u0439\u0442<\/li>\n<li>\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0438 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f <\/li>\n<li>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f) \u043d\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/li>\n<li>\u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430, \u0447\u0442\u043e \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435\u0432\u0435\u0440\u043d\u044b, \u0442\u043e \u0432 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u0443\u044e \u0444\u043e\u0440\u043c\u0443 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435.<\/li>\n<li>\u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430, \u0447\u0442\u043e \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u0435\u0440\u043d\u044b, \u0442\u043e \u043e\u043d\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u0432 \u0411\u0414 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0441 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435\u043c.<\/li>\n<\/ul>\n<p>  <a name=\"habracut\"><\/a><\/p>\n<h5>\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f<\/h5>\n<p>  \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0444\u043e\u0440\u043c\u0443 \u0434\u043b\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u041f\u0440\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0434\u043e\u043b\u0436\u0435\u043d \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0442\u044c \u043a\u0430\u043f\u0447\u0443 \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u0432\u0432\u043e\u0434 \u043f\u0430\u0440\u043e\u043b\u044f. \u041d\u043e \u043d\u0430\u0447\u043d\u0435\u043c \u0431\u0435\u0437 \u044d\u0442\u043e\u0433\u043e. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u0435\u0442\u043e\u0434 Register \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435 UserController \u0438 View.   <\/p>\n<pre><code class=\"cs\">public ActionResult Register()         {             var newUser = new User();             return View(newUser);         } <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0432\u043e View \u043d\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 User. \u0422\u0430\u043a \u043a\u0430\u043a \u043f\u043e\u043b\u0435\u0439 \u0443 \u043d\u0430\u0441 \u043f\u043e\u043a\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0432\u0430, \u0434\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u0435\u043c View:  <\/p>\n<pre><code class=\"html\">@using (Html.BeginForm(&quot;Register&quot;, &quot;User&quot;, FormMethod.Post, new { @class = &quot;form-horizontal&quot; })) {     &lt;fieldset&gt;         &lt;div class=&quot;control-group&quot;&gt;             &lt;label class=&quot;control-label&quot; for=&quot;Email&quot;&gt;                 Email             &lt;\/label&gt;             &lt;div class=&quot;controls&quot;&gt;                 @Html.ValidationMessage(&quot;Email&quot;)                 @Html.TextBox(&quot;Email&quot;, Model.Email)             &lt;\/div&gt;         &lt;\/div&gt;         &lt;div class=&quot;control-group&quot;&gt;             &lt;label class=&quot;control-label&quot; for=&quot;FirstName&quot;&gt;                 Password             &lt;\/label&gt;             &lt;div class=&quot;controls&quot;&gt;                 @Html.ValidationMessage(&quot;Password&quot;)                 @Html.Password(&quot;Password&quot;, Model.Password)             &lt;\/div&gt;         &lt;\/div&gt;         &lt;div class=&quot;form-actions&quot;&gt;             &lt;button type=&quot;submit&quot; class=&quot;btn btn-primary&quot;&gt;                 Register             &lt;\/button&gt;             @Html.ActionLink(&quot;Cancel&quot;, &quot;Index&quot;, null, null, new { @class = &quot;btn&quot; })         &lt;\/div&gt;     &lt;\/fieldset&gt; } <\/code><\/pre>\n<p>  \u0412\u0441\u0435 \u044d\u0442\u0438 \u0434\u0438\u0432\u044b, fieldset&#8217;\u044b \u0438 button\u2019\u044b \u0441\u0434\u0435\u043b\u0430\u043d\u044b \u043f\u043e \u043f\u043e\u0434\u043e\u0431\u0438\u044e, \u043a\u0430\u043a \u044d\u0442\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0435 <a href=\"http:\/\/twitter.github.io\/bootstrap\/\">bootstrap<\/a> (\u0434\u0430\u043b\u0435\u0435 \u0431\u0443\u0434\u0435\u043c \u0438\u0437\u0443\u0447\u0430\u0442\u044c).<br \/>  \u0418\u0437\u0443\u0447\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 Html-\u0432\u0441\u0442\u0430\u0432\u043a\u0438:  <\/p>\n<pre><code class=\"cs\">Html.BeginForm(&quot;Register&quot;, &quot;User&quot;, FormMethod.Post, new { @class = &quot;form-horizontal&quot; }) <\/code><\/pre>\n<p>   \u2014 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u0442\u0435\u0433<code> &lt;form  action=\u201d\/User\/Register\u201d method=\u201dpost\u201d class=\u201dform-horizontal\u201d&gt;<\/code> \u0438 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0435\u0433\u043e \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u0437\u043e\u0432\u0430 <code>Dispose()<\/code> (\u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435 \u043a\u0430\u0432\u044b\u0447\u0435\u043a <code>using() {}<\/code>)<\/p>\n<pre><code class=\"cs\">@Html.TextBox(&quot;Email&quot;, Model.Email) <\/code><\/pre>\n<p>   \u2014 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u0442\u0435\u0433 <code>&lt;input type=\u201dtext\u201d name=\u201dEmail\u201d value=\u201d@Model.Email\u201d&gt;<\/code> (\u0442.\u0435. \u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u0435\u0433\u0430 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 Email \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430)<\/p>\n<pre><code class=\"cs\">@Html.ValidationMessage(&quot;Password&quot;) <\/code><\/pre>\n<p>   \u2014 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0442\u0435\u0433 \u043e\u0448\u0438\u0431\u043a\u0438 \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u0430\u044f \u0435\u0441\u0442\u044c <\/p>\n<pre><code class=\"cs\">@Html.Password(&quot;Password&quot;, Model.Password) <\/code><\/pre>\n<p>   \u2014 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0442\u0435\u0433<code> &lt;input type=\u201dpassword\u201d name=\u201dPassword\u201d value=\u201d@Model.Password\u201d&gt;<\/code><\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 Register \u0438\u0434\u0435\u0442 Http-\u0437\u0430\u043f\u0440\u043e\u0441 \u0442\u0438\u043f\u0430 POST (\u0442\u0430\u043a \u043a\u0430\u043a<code> FormMethod.Post<\/code> \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 Email=&#038;Password=.<br \/>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u0435\u0442\u043e\u0434 Register, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0449\u0438\u0439 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0442\u0438\u043f User, \u0438 \u043f\u043e\u043c\u0435\u0442\u0438\u043c \u0435\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c HttpPost, \u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u2014 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c HttpGet. \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u0435\u0442, \u043a\u0430\u043a\u043e\u0439 \u0438\u0437 \u0442\u0438\u043f\u043e\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0430 \u0442\u043e\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c:  <\/p>\n<pre><code class=\"cs\">[HttpGet]         public ActionResult Register()         {             var newUser = new User();             return View(newUser);         }          [HttpPost]         public ActionResult Register(User user)         {             return View(user);         } <\/code><\/pre>\n<p>  \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0442\u043e\u0447\u043a\u0443 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0430 \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 Register \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u043a\u0430\u043a\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043a \u043d\u0430\u043c:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/9f5\/ae9\/2ab\/9f5ae92ab59520133a199c60c35a5f61.jpg\"\/><\/p>\n<p>  \u0412\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043f\u043e\u043b\u044f Email \u0438 Password \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u044b, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043e\u0441\u0442\u0430\u043b\u0438\u0441\u044c \u043d\u0443\u043b\u0435\u0432\u044b\u043c\u0438 \u0438\u043b\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e (default).<br \/>  \u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u0438\u043d\u044f\u0442\u044c \u0435\u0449\u0435 2 \u043f\u043e\u043b\u044f (\u043f\u043e\u0432\u0442\u043e\u0440 \u043f\u0430\u0440\u043e\u043b\u044f \u0438 \u043a\u0430\u043f\u0447\u0443), \u0442\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u044d\u0442\u0438 \u043f\u043e\u043b\u044f \u0432 \u043d\u0430\u0448 User partial class:  <\/p>\n<pre><code class=\"cs\">public partial class User     {         public static string GetActivateUrl()         {             return Guid.NewGuid().ToString(&quot;N&quot;);         }          public string ConfirmPassword { get; set; }          public string Captcha { get; set; }     } <\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u043e\u043b\u044f \u0432\u043e View:  <\/p>\n<pre><code class=\"html\">&lt;div class=&quot;control-group&quot;&gt;             &lt;label class=&quot;control-label&quot; for=&quot;FirstName&quot;&gt;                 Confirm Password             &lt;\/label&gt;             &lt;div class=&quot;controls&quot;&gt;                 @Html.ValidationMessage(&quot;ConfirmPassword&quot;)                 @Html.Password(&quot;ConfirmPassword&quot;, Model.ConfirmPassword)             &lt;\/div&gt;         &lt;\/div&gt;         &lt;div class=&quot;control-group&quot;&gt;             &lt;label class=&quot;control-label&quot; for=&quot;FirstName&quot;&gt;                 Captcha             &lt;\/label&gt;         &lt;\/div&gt;         &lt;div class=&quot;control-group&quot;&gt;             &lt;label class=&quot;control-label&quot; for=&quot;FirstName&quot;&gt;                 \u0422\u0443\u0442 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 1234             &lt;\/label&gt;             &lt;div class=&quot;controls&quot;&gt;                 @Html.ValidationMessage(&quot;Captcha&quot;)                 @Html.TextBox(&quot;Captcha&quot;, Model.Captcha)             &lt;\/div&gt;         &lt;\/div&gt; <\/code><\/pre>\n<p>  \u041a\u0430\u043f\u0447\u0443 \u043f\u043e\u043a\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c, \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u0430 1234.<\/p>\n<h5>\u0412\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f<\/h5>\n<p>  \u0423\u0441\u043b\u043e\u0432\u0438\u044f \u0434\u043b\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0445:  <\/p>\n<ul>\n<li>\u041f\u043e\u043b\u0435 email \u043d\u0435 \u043d\u0443\u043b\u0435\u0432\u043e\u0435<\/li>\n<li>Email \u2013 \u044d\u0442\u043e \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u043f\u043e\u0447\u0442\u044b, \u0442.\u0435. \u0441 \u0441\u043e\u0431\u0430\u0447\u043a\u043e\u0439<\/li>\n<li>Email \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0439 \u0432 \u0411\u0414 \u2014 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439<\/li>\n<li>\u041f\u0430\u0440\u043e\u043b\u044c \u043d\u0435 \u043d\u0443\u043b\u0435\u0432\u043e\u0439<\/li>\n<li>\u041f\u0430\u0440\u043e\u043b\u0438 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0442<\/li>\n<li>\u041a\u0430\u043f\u0447\u0430 \u0440\u0430\u0432\u043d\u0430 1234<\/li>\n<\/ul>\n<p>  \u0415\u0441\u043b\u0438 \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0438\u0437 \u044d\u0442\u0438\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u043d\u0435 \u0441\u043e\u0431\u043b\u044e\u0434\u0430\u0435\u0442\u0441\u044f, \u0442\u043e \u0432\u044b\u0434\u0430\u0435\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u0430.<\/p>\n<h6>IValidatableObject<\/h6>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a \u0443 \u043d\u0430\u0441 \u043a\u043b\u0430\u0441\u0441 User \u2014 partial, \u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043d\u0435\u0433\u043e IValidatableObject \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e, \u043f\u0440\u0430\u0432\u0434\u0430, \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 System.Component.DataAnnotation. \u042d\u0442\u043e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u0430 \u0441\u0431\u043e\u0440\u043a\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0434\u043b\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438, \u0430 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u2013 \u044d\u0442\u043e \u043f\u0440\u0435\u0440\u043e\u0433\u0430\u0442\u0438\u0432\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u0432 MVC. \u0422\u0430\u043a \u0447\u0442\u043e \u043c\u044b \u0442\u0443\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u0430\u0440\u0443\u0448\u0430\u0435\u043c \u043f\u0440\u0438\u043d\u0446\u0438\u043f.<br \/>  \u041a\u043b\u0430\u0441\u0441 User:  <\/p>\n<pre><code class=\"cs\">public partial class User : IValidatableObject     {         public static string GetActivateUrl()         {             return Guid.NewGuid().ToString(&quot;N&quot;);         }          public string ConfirmPassword { get; set; }          public string Captcha { get; set; }           public IEnumerable&lt;ValidationResult&gt; Validate(ValidationContext validationContext)         {             \/\/\u041d\u0435 \u043d\u0443\u043b\u0435\u0432\u043e\u0439 Email             if (string.IsNullOrWhiteSpace(Email))             {                 yield return new ValidationResult(&quot;\u0412\u0432\u0435\u0434\u0438\u0442\u0435 email&quot;, new string[] {&quot;Email&quot;});             }             \/\/\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439 Email             var regex = new Regex(@&quot;\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*&quot;, RegexOptions.Compiled);             var match = regex.Match(Email);             if (!(match.Success && match.Length == Email.Length))              {                 yield return new ValidationResult(&quot;\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439 email&quot;, new string[] { &quot;Email&quot; });             }                          \/\/\u043f\u0430\u0440\u043e\u043b\u044c \u043d\u0435 \u043d\u0443\u043b\u0435\u0432\u043e\u0439             if (string.IsNullOrWhiteSpace(Password))             {                 yield return new ValidationResult(&quot;\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043f\u0430\u0440\u043e\u043b\u044c&quot;, new string[] { &quot;Password&quot; });              }              \/\/\u043f\u0430\u0440\u043e\u043b\u0438 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0442             if (Password != ConfirmPassword)             {                 yield return new ValidationResult(&quot;\u041f\u0430\u0440\u043e\u043b\u0438 \u043d\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0442&quot;, new string[] { &quot;ConfirmPassword&quot; });             }         }     } <\/code><\/pre>\n<p>  \u041c\u044b \u0441\u043c\u043e\u0433\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 4 \u0438\u0437 6 \u043f\u0440\u0430\u0432\u0438\u043b \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438, \u043d\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u043f\u043e\u043a\u0430 \u0442\u0430\u043a, \u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435.<br \/>  \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0444\u043e\u0440\u043c\u0443, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/3bd\/d97\/21e\/3bdd9721ec275df450beecee0eca7a40.jpg\"\/><\/p>\n<p>  \u0412\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043e\u0431\u0435 \u043d\u0430\u0448\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u0431\u044b\u043b\u0438 \u043e\u0442\u043b\u043e\u0432\u043b\u0435\u043d\u044b.<\/p>\n<p>  \u0415\u0441\u0442\u044c \u0434\u0432\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u0430 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u043e\u0448\u0438\u0431\u043a\u0443: \u044d\u0442\u043e Html.ValidationMessage(\u201cErrorField\u201d) \u0438 Html.ValidationSummary(). \u041f\u0435\u0440\u0432\u044b\u0439 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u043e\u0448\u0438\u0431\u043a\u0443, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0443\u044e \u0441 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c \u043d\u0435\u0432\u0435\u0440\u043d\u043e\u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u043c \u043f\u043e\u043b\u0435\u043c, \u0430 \u0432\u0442\u043e\u0440\u043e\u0435 \u2014 \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u0432\u0441\u0435 (\u0438\u043b\u0438 \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0435\u0441\u044f) \u043e\u0448\u0438\u0431\u043a\u0438.<\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0430 \u043a\u0430\u043f\u0447\u0443 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u0435 Email \u0432 \u0411\u0414 (\/Areas\/Default\/UserController.cs:Register):  <\/p>\n<pre><code class=\"cs\">if (user.Captcha != &quot;1234&quot;)        {             ModelState.AddModelError(&quot;Captcha&quot;, &quot;\u0422\u0435\u043a\u0441\u0442 \u0441 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u0432\u0432\u0435\u0434\u0435\u043d \u043d\u0435\u0432\u0435\u0440\u043d\u043e&quot;);        }        var anyUser = Repository.Users.Any(p =&gt; string.Compare(p.Email, user.Email) == 0);        if (anyUser)        {      ModelState.AddModelError(&quot;Email&quot;, &quot;\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441 \u0442\u0430\u043a\u0438\u043c email \u0443\u0436\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d&quot;);        } <\/code><\/pre>\n<p>  \u0418 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/155\/453\/b8b\/155453b8be57a9a3428ad1bf2a886217.jpg\"\/><\/p>\n<p>  \u0427\u0442\u043e \u0436, \u0441 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u043c\u044b \u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0438\u0441\u044c, \u043d\u043e \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0442\u0430\u043a\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c:  <\/p>\n<ul>\n<li>\u041a\u043b\u0430\u0441\u0441 User \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u043e\u043b\u044f \u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u043e\u0441\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u0435\u0439, \u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043b\u0438\u0447\u043d\u043e\u043c \u043a\u0430\u0431\u0438\u043d\u0435\u0442\u0435, \u043c\u044b \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u0432\u043e\u0434\u0438\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044c. \u0422.\u0435. \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u0432\u043e\u0434\u0438\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0442\u044c: \u044d\u0442\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f, \u044d\u0442\u043e \u0441\u043c\u0435\u043d\u0430 \u043f\u0430\u0440\u043e\u043b\u044f, \u044d\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445.<\/li>\n<li>\u0412\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e \u0432 Model-\u0447\u0430\u0441\u0442\u0438 \u0438 \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e \u0432 Controller-\u0447\u0430\u0441\u0442\u0438 \u2013 \u044d\u0442\u043e \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0445\u0440\u0435\u0441\u0442\u043e\u043c\u0430\u0442\u0438\u0439\u043d\u043e.<\/li>\n<\/ul>\n<p>  \u041d\u043e \u0435\u0441\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u0430 User, \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0443\u044e\u0449\u0438\u043c \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e. \u041c\u044b \u043d\u0430\u0437\u043e\u0432\u0435\u043c \u0435\u0433\u043e UserView \u0438 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0432 \u043f\u0430\u043f\u043a\u0435 Models\/ViewModels:  <\/p>\n<pre><code class=\"cs\"> public class UserView     {         public int ID { get; set; }          public string Email { get; set; }          public string Password { get; set; }          public string ConfirmPassword { get; set; }          public string Captcha { get; set; }          public string AvatarPath { get; set; }      } <\/code><\/pre>\n<h5>Automapping <\/h5>\n<p>  \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430, \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0443\u0434\u043e\u0431\u043d\u043e. \u041c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u043b\u0430\u0441\u0441, \u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u0411\u0414 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043a\u043b\u0430\u0441\u0441 User, \u0430 \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0432 \u043a\u0430\u043a\u043e\u043c-\u0442\u043e \u043c\u0435\u0441\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 UserView \u0432 User \u043f\u043e\u043b\u044f, \u0442\u0430\u043a \u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442. \u0410 \u043f\u0440\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 \u043f\u043e\u043b\u0435\u0439 \u2013 \u044d\u0442\u043e \u0440\u0443\u0442\u0438\u043d\u043d\u043e, \u043a \u0442\u043e\u043c\u0443 \u0436\u0435, \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435 \u0443 \u043d\u0430\u0441 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 Update[Table] \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438. \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0435 \u043c\u0430\u043f\u043f\u0435\u0440\u044b object-to-object.<br \/>  \u041e\u0434\u043d\u0438\u043c \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f automapper (<a href=\"http:\/\/automapper.org\/\">http:\/\/automapper.org\/<\/a>). \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u044d\u0442\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0431\u0435\u0440\u0435\u0442 \u043d\u0430 \u0441\u0435\u0431\u044f \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0443 \u043e\u0434\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439, \u0438, \u043a\u0430\u043a \u043c\u044b \u0434\u0430\u043b\u044c\u0448\u0435 \u0443\u0432\u0438\u0434\u0438\u043c, \u0442\u0430\u043c \u0435\u0449\u0435 \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u0432\u043a\u0443\u0441\u043d\u044b\u0445 \u043f\u043b\u044e\u0448\u0435\u043a.<\/p>\n<p>  \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c Automapper:  <\/p>\n<pre><code class=\"bash\">Install-Package AutoMapper <\/code><\/pre>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043c\u044b \u0438\u0437\u0431\u0435\u0433\u0430\u0435\u043c \u0441\u0438\u043b\u044c\u043d\u0443\u044e \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u044c, \u0442\u043e \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0443\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 + \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0438 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u044d\u0442\u043e \u0432 Ninject, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0432\u044b\u0432\u0435\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440.<br \/>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0432 \/Mappers:<\/p>\n<pre><code class=\"cs\">public interface IMapper     {         object Map(object source, Type sourceType, Type destinationType);     }  <\/code><\/pre>\n<p>  \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f:  <\/p>\n<pre><code class=\"cs\">public class CommonMapper : IMapper     {         static CommonMapper()         {             Mapper.CreateMap&lt;User, UserView&gt;();             Mapper.CreateMap&lt;UserView, User&gt;();         }          public object Map(object source, Type sourceType, Type destinationType)         {             return Mapper.Map(source, sourceType, destinationType);         }     }  <\/code><\/pre>\n<p>  \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f (\u043f\u0443\u0441\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u043a\u0430\u043a \u043e\u0431\u044a\u0435\u043a\u0442-\u043e\u0434\u0438\u043d\u043e\u0447\u043a\u0430) (\/App_Start\/NinjectWebCommon.cs):<\/p>\n<pre><code class=\"cs\">kernel.Bind&lt;IMapper&gt;().To&lt;CommonMapper&gt;().InSingletonScope(); <\/code><\/pre>\n<p>  \u0412 BaseController (\/Controllers\/BaseController.cs):  <\/p>\n<pre><code class=\"cs\">    public abstract class BaseController : Controller     {         [Inject]         public IRepository Repository { get; set; }          [Inject]         public IMapper ModelMapper { get; set; }     } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0438\u0437\u043c\u0435\u043d\u0438\u043c UserController (\u0438 View) \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c UserView:  <\/p>\n<pre><code class=\"cs\">[HttpGet]         public ActionResult Register()         {             var newUserView = new UserView();             return View(newUserView);         }          [HttpPost]         public ActionResult Register(UserView userView)         {             if (userView.Captcha != &quot;1234&quot;)             {                 ModelState.AddModelError(&quot;Captcha&quot;, &quot;\u0422\u0435\u043a\u0441\u0442 \u0441 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u0432\u0432\u0435\u0434\u0435\u043d \u043d\u0435\u0432\u0435\u0440\u043d\u043e&quot;);             }             var anyUser = Repository.Users.Any(p =&gt; string.Compare(p.Email, userView.Email) == 0);             if (anyUser)             {                 ModelState.AddModelError(&quot;Email&quot;, &quot;\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441 \u0442\u0430\u043a\u0438\u043c email \u0443\u0436\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d&quot;);             }              if (ModelState.IsValid)             {                 var user = (User)ModelMapper.Map(userView, typeof(UserView), typeof(User));                 \/\/TODO: \u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c             }             return View(userView);         }  <\/code><\/pre>\n<p>  \u0418 \u0432 Register.cshtml \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430:  <\/p>\n<pre><code class=\"cs\">@model LessonProject.Models.ViewModels.UserView <\/code><\/pre>\n<h6>\u0410\u0442\u0440\u0438\u0431\u0443\u0442\u044b<\/h6>\n<p>  \u0414\u043b\u044f UserView \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b.<\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u0431\u043e\u0440\u043a\u0443:  <\/p>\n<pre><code class=\"cs\"> using System.ComponentModel.DataAnnotations; public class UserView     {         public int ID { get; set; }          [Required(ErrorMessage=&quot;\u0412\u0432\u0435\u0434\u0438\u0442\u0435 email&quot;)]         public string Email { get; set; }          [Required(ErrorMessage=&quot;\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043f\u0430\u0440\u043e\u043b\u044c&quot;)]         public string Password { get; set; }          [Compare(&quot;Password&quot;, ErrorMessage=&quot;\u041f\u0430\u0440\u043e\u043b\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0442\u044c&quot;)]         public string ConfirmPassword { get; set; }          public string Captcha { get; set; }          public string AvatarPath { get; set; }     } <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/2ba\/8ce\/e6a\/2ba8cee6a6ae92cda271b82fb98dbe7e.jpg\"\/><\/p>\n<p>  \u041c\u044b \u0441\u043c\u043e\u0433\u043b\u0438 \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0443\u0442 5 \u0438\u0437 6 \u043f\u0440\u0430\u0432\u0438\u043b \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438. \u041f\u0440\u0430\u0432\u0438\u043b\u0430, \u043a\u0430\u0441\u0430\u044e\u0449\u0435\u0433\u043e\u0441\u044f \u0432\u0435\u0440\u043d\u043e\u0433\u043e \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0433\u043e email \u2013 \u043d\u0435\u0442. \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u0432\u043e\u0439 \u043a\u043b\u0430\u0441\u0441-\u0430\u0442\u0440\u0438\u0431\u0443\u0442, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0449\u0438\u0439 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0433\u043e email:   <\/p>\n<pre><code class=\"cs\"> [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]     public class ValidEmailAttribute : ValidationAttribute     {         public override bool IsValid(object value)         {             if (value == null)             {                 return true;             }             if (!(value is string))             {                 return true;             }             var source = value as string;             if (string.IsNullOrWhiteSpace(source))             {                 return true;             }              var regex = new Regex(@&quot;\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*&quot;, RegexOptions.Compiled);             var match = regex.Match(source);             return (match.Success && match.Length == source.Length);         }     } <\/code><\/pre>\n<p>  \u0412\u043d\u0430\u0447\u0430\u043b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0435\u0441\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0430, \u0438 \u0441\u0442\u0440\u043e\u043a\u0430 \u043d\u0435 \u043f\u0443\u0441\u0442\u0430\u044f, \u0438\u043d\u0430\u0447\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u00ab\u0438\u0441\u0442\u0438\u043d\u0430\u00bb \u0432 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435. \u0422\u0443\u0442 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0447\u0442\u043e \u00ab\u043c\u044b \u0443 \u0438\u043d\u043e\u043f\u043b\u0430\u043d\u0435\u0442\u044f\u043d \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c\u00bb, \u0442.\u0435. \u043f\u043e\u043a\u0430 \u043d\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u2013 \u043c\u044b \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0431\u0443\u0434\u0443\u0442 \u0434\u0440\u0443\u0433\u0438\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b. \u041f\u043e\u0442\u043e\u043c \u0436\u0435, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c. \u041f\u0440\u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0438, \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043b\u043d\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u043c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432\u0441\u0435\u0445 \u0434\u043e\u043c\u0435\u043d\u043e\u0432 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f.<\/p>\n<p>  <i>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u041c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c DataAnnotationsExtensions, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u044b\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b (<a href=\"http:\/\/dataannotationsextensions.org\/\">http:\/\/dataannotationsextensions.org\/<\/a>)<\/i><\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043f\u043e\u043b\u0435 \u0434\u043d\u044f \u0440\u043e\u0436\u0434\u0435\u043d\u0438\u044f. \u0414\u0430, \u043f\u0440\u044f\u043c\u043e \u0441\u0435\u0439\u0447\u0430\u0441, \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0431\u043e\u0440 \u0434\u0430\u0442\u044b.<\/p>\n<ol>\n<li>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u043b\u0435 \u0432 \u0411\u0414. Birthdate datetime null.<br \/>  <i>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u043d\u044f\u0442\u044c \u044d\u0442\u0443 \u0433\u0430\u043b\u043e\u0447\u043a\u0443, \u0447\u0442\u043e\u0431\u044b \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0411\u0414: <\/i><br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/3d4\/c6d\/cb1\/3d4c6dcb18c9a12f6b24a76369549397.jpg\"\/>  <\/li>\n<li>\u0412 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u044b\u0441\u0442\u0430\u0432\u0438\u043c \u0432\u0441\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u044f\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f 2012-1-1  <\/li>\n<li>\u0418\u0437\u043c\u0435\u043d\u0438\u043c \u043f\u043e\u043b\u0435 Birthdate \u043d\u0430 datetime not null<\/li>\n<li>\u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0438\u0437<code> LessonProjectDb.dbml<\/code> \u0442\u0430\u0431\u043b\u0438\u0446\u0443 User \u0438 \u0437\u0430\u043d\u043e\u0432\u043e \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c \u0438\u0437 Server Explorer<\/li>\n<li>\u0412 SqlRepository\/User.cs \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 UpdateUser():<br \/> \n<pre><code class=\"cs\">public bool UpdateUser(User instance)         {             User cache = Db.Users.Where(p =&gt; p.ID == instance.ID).FirstOrDefault();             if (cache != null)             {                 cache.Birthdate = instance.Birthdate;                 cache.AvatarPath = instance.AvatarPath;                 cache.Email = instance.Email;                 Db.Users.Context.SubmitChanges();                 return true;             }             return false;         } <\/code><\/pre>\n<p>  <\/li>\n<li>\u0412 UserView \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0434\u0440\u0443\u0433\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e \u043f\u043e\u043b\u0435 Bithdate. \u0418 \u043e\u0431 \u044d\u0442\u043e\u043c \u0447\u0443\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e.<\/li>\n<\/ol>\n<p>  \u0412\u044b\u0431\u043e\u0440 \u0434\u043d\u044f \u0440\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u0438\u043c:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/cc5\/404\/43b\/cc540443b61ecda733a52aa4630f513d.jpg\"\/><\/p>\n<p>  \u0422\u0443\u0442 \u043d\u0430\u0434\u043e \u0440\u0435\u0448\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0434\u0430\u0447. \u041f\u0435\u0440\u0432\u0430\u044f \u0438\u0437 \u043d\u0438\u0445 \u2013 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u044b\u043f\u0430\u0434\u0430\u044e\u0449\u0435\u0433\u043e \u0441\u043f\u0438\u0441\u043e\u043a\u0430. \u0412 Html (\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0435\u0449\u0435 \u043f\u043e\u0437\u0436\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435) \u0435\u0441\u0442\u044c DropDownList, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0432\u044b\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u0439 \u0441\u043f\u0438\u0441\u043e\u043a. <br \/>  \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0442\u0430\u043a\u0438\u0435:<br \/>  <code>@Html.DropDownList(string name, IEnumerable&lt;SelectListItem&gt; selectList)<\/code><\/p>\n<p>  \u0421\u043c\u043e\u0442\u0440\u0438\u043c SelectListItem:  <\/p>\n<pre><code class=\"cs\">public class SelectListItem     {         public SelectListItem();          public bool Selected { get; set; }         public string Text { get; set; }         public string Value { get; set; }     } <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0432\u044b\u0431\u043e\u0440\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0437 1 \u2014 apple, 2 \u2013 orange (\u0432\u044b\u0431\u0440\u0430\u043d), 3 \u2014 banana \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:  <\/p>\n<pre><code class=\"cs\">public IEnumerable&lt;SelectListItem&gt; SelectFruit         {             get             { yield return new SelectListItem() { Value = &quot;1&quot;, Text = &quot;apple&quot;, Selected = false }; yield return new SelectListItem() { Value = &quot;2&quot;, Text = &quot;orange&quot;, Selected = true }; yield return new SelectListItem() { Value = &quot;3&quot;, Text = &quot;banana&quot;, Selected = false };             }         }  <\/code><\/pre>\n<p>  \u0418 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0432 <code>DropDownList()<\/code> \u0432\u0442\u043e\u0440\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c, \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u2013 name, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 Value \u043f\u0440\u0438 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0438 (\u0441\u0430\u0431\u043c\u0438\u0442\u0435) \u0444\u043e\u0440\u043c\u044b. <br \/>  C\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u0432\u044b\u0431\u043e\u0440\u0430 \u0434\u043d\u044f \u0440\u043e\u0436\u0434\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"cs\">public int BirthdateDay { get; set; }          public int BirthdateMonth { get; set; }          public int BirthdateYear { get; set; }          public IEnumerable&lt;SelectListItem&gt; BirthdateDaySelectList         {             get             {                 for (int i = 1; i &lt; 32; i++)                 {                     yield return new SelectListItem                     {                         Value = i.ToString(),                         Text = i.ToString(),                         Selected = BirthdateDay == i                     };                 }             }         }          public IEnumerable&lt;SelectListItem&gt; BirthdateMonthSelectList         {             get             {                 for (int i = 1; i &lt; 13; i++)                 {                     yield return new SelectListItem                     {                         Value = i.ToString(),                         Text = new DateTime(2000, i, 1).ToString(&quot;MMMM&quot;),                         Selected = BirthdateMonth == i                     };                 }             }         }          public IEnumerable&lt;SelectListItem&gt; BirthdateYearSelectList         {             get             {                 for (int i = 1910; i &lt; DateTime.Now.Year; i++)                 {                     yield return new SelectListItem                     {                         Value = i.ToString(),                         Text = i.ToString(),                         Selected = BirthdateYear == i                     };                 }             }         } <\/code><\/pre>\n<p>  \u0418 \u0432\u043e View:  <\/p>\n<pre><code class=\"html\">  &lt;div class=&quot;control-group&quot;&gt;             &lt;label class=&quot;control-label&quot; for=&quot;FirstName&quot;&gt;                 Birth date             &lt;\/label&gt;             &lt;div class=&quot;controls&quot;&gt;                 @Html.DropDownList(&quot;BirthdateDay&quot;, Model.BirthdateDaySelectList)                 @Html.DropDownList(&quot;BirthdateMonth&quot;, Model.BirthdateMonthSelectList)                 @Html.DropDownList(&quot;BirthdateYear&quot;, Model.BirthdateYearSelectList)             &lt;\/div&gt;         &lt;\/div&gt; <\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0431\u0440\u0435\u0439\u043a-\u043f\u043e\u0438\u043d\u0442 point \u043d\u0430 \u043f\u0440\u0438\u0435\u043c\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u043a\u0430\u043a \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043f\u043e\u043b\u0435\u0439 \u0434\u0430\u0442\u044b \u0440\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 UserView:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/72b\/cba\/4e5\/72bcba4e5fe5ac5e1a1e45624a246217.jpg\"\/><\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/1ba\/353\/f37\/1ba353f37fdf868c3810f5cf938d6f4e.jpg\"\/><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0438\u0445 \u0432 \u043e\u0431\u044a\u0435\u043a\u0442 User. \u041e\u043f\u0438\u0448\u0435\u043c \u044d\u0442\u0443 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0432 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043c\u0430\u043f\u043f\u0438\u043d\u0433\u0430 (\/Mappers\/CommonMapper.cs):  <\/p>\n<pre><code class=\"cs\">            Mapper.CreateMap&lt;User, UserView&gt;() .ForMember(dest =&gt; dest.BirthdateDay, opt =&gt; opt.MapFrom(src =&gt; src.Birthdate.Day)) .ForMember(dest =&gt; dest.BirthdateMonth, opt =&gt; opt.MapFrom(src =&gt; src.Birthdate.Month)) .ForMember(dest =&gt; dest.BirthdateYear, opt =&gt; opt.MapFrom(src =&gt;src.Birthdate.Year));             Mapper.CreateMap&lt;UserView, User&gt;()                     .ForMember(dest =&gt; dest.Birthdate, opt =&gt; opt.MapFrom(src =&gt; new DateTime(src.BirthdateYear, src.BirthdateMonth, src.BirthdateDay))); <\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0437\u0430\u0434\u0430\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0438\u0437 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 BirthdateDay, BirthdateMonth, BirthdateYear \u0432 Birthdate \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e.<\/p>\n<h5>Captcha<\/h5>\n<p>  \u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u0430\u043f\u0447\u0438, \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u043d\u0430\u043c \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u0441 \u0446\u0438\u0444\u0440\u0430\u043c\u0438 \u0438 \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u043a\u0430\u043a \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443. \u0421\u0430\u043c\u0438 \u0446\u0438\u0444\u0440\u044b \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u044b \u0432 \u0441\u0435\u0441\u0441\u0438\u043e\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u041f\u0440\u043e \u0441\u0435\u0441\u0441\u0438\u044e \u043c\u044b \u0434\u0430\u043b\u044c\u0448\u0435 \u0435\u0449\u0435 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c. \u0421\u0435\u0439\u0447\u0430\u0441 \u043d\u0430\u0434\u043e \u0437\u043d\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e, \u0447\u0442\u043e \u0441\u0435\u0441\u0441\u0438\u044f \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c Tools\/CaptchaImage.cs:<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">\/\/\/ &lt;summary&gt;     \/\/\/ \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043a\u0430\u043f\u0447\u0438      \/\/\/ &lt;\/summary&gt;     public class CaptchaImage     {         public const string CaptchaValueKey = &quot;CaptchaImageText&quot;;          public string Text         {             get { return text; }         }         public Bitmap Image         {             get { return image; }         }         public int Width         {             get { return width; }         }         public int Height         {             get { return height; }         }          \/\/ Internal properties.         private string text;         private int width;         private int height;         private string familyName;         private Bitmap image;          \/\/ For generating random numbers.         private Random random = new Random();          public CaptchaImage(string s, int width, int height)         {             text = s;             SetDimensions(width, height);             GenerateImage();         }          public CaptchaImage(string s, int width, int height, string familyName)         {             text = s;             SetDimensions(width, height);             SetFamilyName(familyName);             GenerateImage();         }          \/\/ ====================================================================         \/\/ This member overrides Object.Finalize.         \/\/ ====================================================================         ~CaptchaImage()         {             Dispose(false);         }          \/\/ ====================================================================         \/\/ Releases all resources used by this object.         \/\/ ====================================================================         public void Dispose()         {             GC.SuppressFinalize(this);             Dispose(true);         }          \/\/ ====================================================================         \/\/ Custom Dispose method to clean up unmanaged resources.         \/\/ ====================================================================         protected virtual void Dispose(bool disposing)         {             if (disposing)                 \/\/ Dispose of the bitmap.                 image.Dispose();         }          \/\/ ====================================================================         \/\/ Sets the image aWidth and aHeight.         \/\/ ====================================================================         private void SetDimensions(int aWidth, int aHeight)         {             \/\/ Check the aWidth and aHeight.             if (aWidth &lt;= 0)                 throw new ArgumentOutOfRangeException(&quot;aWidth&quot;, aWidth, &quot;Argument out of range, must be greater than zero.&quot;);             if (aHeight &lt;= 0)                 throw new ArgumentOutOfRangeException(&quot;aHeight&quot;, aHeight, &quot;Argument out of range, must be greater than zero.&quot;);             width = aWidth;             height = aHeight;         }          \/\/ ====================================================================         \/\/ Sets the font used for the image text.         \/\/ ====================================================================         private void SetFamilyName(string aFamilyName)         {             \/\/ If the named font is not installed, default to a system font.             try             {                 Font font = new Font(aFamilyName, 12F);                 familyName = aFamilyName;                 font.Dispose();             }             catch (Exception)             {                 familyName = FontFamily.GenericSerif.Name;             }         }          \/\/ ====================================================================         \/\/ Creates the bitmap image.         \/\/ ====================================================================         private void GenerateImage()         {             \/\/ Create a new 32-bit bitmap image.             Bitmap bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb);              \/\/ Create a graphics object for drawing.             Graphics g = Graphics.FromImage(bitmap);             g.SmoothingMode = SmoothingMode.AntiAlias;             Rectangle rect = new Rectangle(0, 0, width, height);              \/\/ Fill in the background.             HatchBrush hatchBrush = new HatchBrush(HatchStyle.SmallConfetti, Color.LightGray, Color.White);             g.FillRectangle(hatchBrush, rect);              \/\/ Set up the text font.             SizeF size;             float fontSize = rect.Height + 1;             Font font;             \/\/ Adjust the font size until the text fits within the image.             do             {                 fontSize--;                 font = new Font(familyName, fontSize, FontStyle.Bold);                 size = g.MeasureString(text, font);             } while (size.Width &gt; rect.Width);              \/\/ Set up the text format.             StringFormat format = new StringFormat();             format.Alignment = StringAlignment.Center;             format.LineAlignment = StringAlignment.Center;              \/\/ Create a path using the text and warp it randomly.             GraphicsPath path = new GraphicsPath();             path.AddString(text, font.FontFamily, (int)font.Style, font.Size, rect, format);             float v = 4F;             PointF[] points = \t\t\t{ \t\t\t\tnew PointF(random.Next(rect.Width) \/ v, random.Next(rect.Height) \/ v), \t\t\t\tnew PointF(rect.Width - random.Next(rect.Width) \/ v, random.Next(rect.Height) \/ v), \t\t\t\tnew PointF(random.Next(rect.Width) \/ v, rect.Height - random.Next(rect.Height) \/ v), \t\t\t\tnew PointF(rect.Width - random.Next(rect.Width) \/ v, rect.Height - random.Next(rect.Height) \/ v) \t\t\t};             Matrix matrix = new Matrix();             matrix.Translate(0F, 0F);             path.Warp(points, rect, matrix, WarpMode.Perspective, 0F);              \/\/ Draw the text.             hatchBrush = new HatchBrush(HatchStyle.LargeConfetti, Color.LightGray, Color.DarkGray);             g.FillPath(hatchBrush, path);              \/\/ Add some random noise.             int m = Math.Max(rect.Width, rect.Height);             for (int i = 0; i &lt; (int)(rect.Width * rect.Height \/ 30F); i++)             {                 int x = random.Next(rect.Width);                 int y = random.Next(rect.Height);                 int w = random.Next(m \/ 50);                 int h = random.Next(m \/ 50);                 g.FillEllipse(hatchBrush, x, y, w, h);             }              \/\/ Clean up.             font.Dispose();             hatchBrush.Dispose();             g.Dispose();              \/\/ Set the image.             image = bitmap;         }     }  <\/code><\/pre>\n<\/p><\/div>\n<\/div>\n<p>  \u0421\u0443\u0442\u044c \u0442\u0430\u043a\u043e\u0432\u0430, \u0447\u0442\u043e \u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e Image \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0430\u044f \u0438\u0437 \u0446\u0438\u0444\u0440 (\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u0430\u043a \u0431\u044b \u0441\u043b\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0442\u044c) \u043c\u0435\u0442\u043e\u0434\u043e\u043c GenerateImage().<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043c\u0435\u0442\u043e\u0434 \u0432\u044b\u0432\u043e\u0434\u0430 UserController.Captcha():  <\/p>\n<pre><code class=\"cs\">public ActionResult Captcha()         {             Session[CaptchaImage.CaptchaValueKey] = new Random(DateTime.Now.Millisecond).Next(1111, 9999).ToString();             var ci = new CaptchaImage(Session[CaptchaImage.CaptchaValueKey].ToString(), 211, 50, &quot;Arial&quot;);              \/\/ Change the response headers to output a JPEG image.             this.Response.Clear();             this.Response.ContentType = &quot;image\/jpeg&quot;;              \/\/ Write the image to the response stream in JPEG format.             ci.Image.Save(this.Response.OutputStream, ImageFormat.Jpeg);              \/\/ Dispose of the CAPTCHA image object.             ci.Dispose();             return null;         } <\/code><\/pre>\n<p>  \u0427\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442:   <\/p>\n<ul>\n<li>\u0412 \u0441\u0435\u0441\u0441\u0438\u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043e\u0442 1111 \u0434\u043e 9999. <\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0432 ci \u043e\u0431\u044a\u0435\u043a\u0442 CatchaImage<\/li>\n<li>\u041e\u0447\u0438\u0449\u0430\u0435\u043c \u043f\u043e\u0442\u043e\u043a \u0432\u044b\u0432\u043e\u0434\u0430<\/li>\n<li>\u0417\u0430\u0434\u0430\u0435\u043c header \u0434\u043b\u044f mime-\u0442\u0438\u043f\u0430 \u044d\u0442\u043e\u0433\u043e http-\u043e\u0442\u0432\u0435\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u201cimage\/jpeg\u201d \u0442.\u0435. \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 jpeg.<\/li>\n<li>\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c bitmap \u0432 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u043f\u043e\u0442\u043e\u043a \u0441 \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u043c ImageFormat.Jpeg<\/li>\n<li>\u041e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u044b Bitmap<\/li>\n<li>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c null, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0443\u0436\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u0430 \u0432 \u043f\u043e\u0442\u043e\u043a \u0432\u044b\u0432\u043e\u0434\u0430<\/li>\n<\/ul>\n<p>  \u0417\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u0438\u0437 Register.cshtml (\/Areas\/Default\/View\/User\/Register.cshtml):  <\/p>\n<pre><code class=\"html\">&lt;label class=&quot;control-label&quot; for=&quot;FirstName&quot;&gt;        \t&lt;img src=&quot;@Url.Action(&quot;Captcha&quot;, &quot;User&quot;)&quot; alt=&quot;captcha&quot; \/&gt; &lt;\/label&gt; <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 (\/Areas\/Default\/Controllers\/UserController.cs):  <\/p>\n<pre><code class=\"cs\">if (userView.Captcha != (string)Session[CaptchaImage.CaptchaValueKey])        {        \tModelState.AddModelError(&quot;Captcha&quot;, &quot;\u0422\u0435\u043a\u0441\u0442 \u0441 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u0432\u0432\u0435\u0434\u0435\u043d \u043d\u0435\u0432\u0435\u0440\u043d\u043e&quot;);        } <\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u0438 \u0432\u0441\u0451, \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u043a\u0430\u043a \u043e\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442:  <\/p>\n<pre><code class=\"cs\">if (ModelState.IsValid)             { var user = (User)ModelMapper.Map(userView, typeof(UserView), typeof(User));  Repository.CreateUser(user); return RedirectToAction(&quot;Index&quot;);             } <\/code><\/pre>\n<p>  \u0412\u0441\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <a href=\"https:\/\/bitbucket.org\/chernikov\/lessons\">https:\/\/bitbucket.org\/chernikov\/lessons<\/a>    \t \t\t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/176023\/\"> http:\/\/habrahabr.ru\/post\/176023\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t<b>\u0426\u0435\u043b\u044c \u0443\u0440\u043e\u043a\u0430.<\/b> \u041e\u0442\u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0432\u0435\u0441\u044c \u043f\u0443\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0411\u0414 \u0438 \u0432\u044b\u0432\u043e\u0434\u0430 \u0435\u0433\u043e. \u0412\u044b\u0432\u043e\u0434 \u043e\u0448\u0438\u0431\u043e\u043a. \u0412\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f. \u041c\u0430\u043f\u043f\u0435\u0440\u044b. \u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438. \u041a\u0430\u043f\u0447\u0430. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0411\u0414. <\/p>\n<h5>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h5>\n<p>  \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0432\u0430\u0436\u043d\u044b\u0445 \u0443\u0440\u043e\u043a\u043e\u0432, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043d\u043e \u043f\u0440\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. \u041b\u044e\u0431\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435, \u043e\u0442 \u0441\u043b\u043e\u0436\u043d\u044b\u0445, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u0443\u044e \u0430\u043d\u043a\u0435\u0442\u0443, \u0434\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u0445, \u043a\u043e\u0433\u0434\u0430 \u0441\u0442\u0430\u0432\u0438\u043c \u043b\u0430\u0439\u043a, \u2013 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:  <\/p>\n<ul>\n<li>Post\\get \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0441\u0430\u0439\u0442<\/li>\n<li>\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0438 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f <\/li>\n<li>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f) \u043d\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/li>\n<li>\u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430, \u0447\u0442\u043e \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435\u0432\u0435\u0440\u043d\u044b, \u0442\u043e \u0432 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u0443\u044e \u0444\u043e\u0440\u043c\u0443 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435.<\/li>\n<li>\u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430, \u0447\u0442\u043e \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u0435\u0440\u043d\u044b, \u0442\u043e \u043e\u043d\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u0432 \u0411\u0414 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0441 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435\u043c.<\/li>\n<\/ul>\n<p>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-176023","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/176023","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=176023"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/176023\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=176023"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=176023"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=176023"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}