コード例 #1
0
        public virtual ActionResult Create(CreateArticleViewModel articleViewModel)
        {
            try
            {
                var membershipUser = Membership.GetUser(User.Identity.Name);
                if (membershipUser != null)
                    if (membershipUser.ProviderUserKey != null)
                        articleViewModel.UserId = Guid.Parse(membershipUser.ProviderUserKey.ToString());

                GetCommand<CreateArticleCommand>().ExecuteCommand(articleViewModel);
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
コード例 #2
0
 public Article CreateArticleViewModel2Article(CreateArticleViewModel request)
 {
     var article = new Article {UserId = request.UserId, Title = request.Title, Text = request.Text};
     return article;
 }