Example #1
0
        public async Task <IActionResult> Create(int id)
        {
            UserProfileCommentCreateViewModel viewModel = new UserProfileCommentCreateViewModel
            {
                Author             = await userManager.GetUserAsync(HttpContext.User),
                UserProfile        = await userProfileService.GetByIDAsync(id),
                UserProfileComment = new UserProfileComment()
            };

            return(PartialView("_Create", viewModel));
        }
Example #2
0
        public async Task <IActionResult> Create(UserProfileCommentCreateViewModel viewModel)
        {
            UserProfileComment userProfileComment = new UserProfileComment
            {
                ID            = viewModel.UserProfileComment.ID,
                Body          = viewModel.UserProfileComment.Body,
                DateCreated   = DateTime.Now,
                CreatedByID   = userManager.GetUserAsync(HttpContext.User).Result.Id,
                CreatedBy     = await userManager.GetUserAsync(HttpContext.User),
                UserProfileID = viewModel.UserProfile.ID,
                UserProfile   = viewModel.UserProfile
            };

            await userProfileCommentService.InsertAsync(userProfileComment);

            return(RedirectToAction("Profile", "UserProfileComment", userProfileComment.UserProfileID));
        }