Example #1
0
        public async Task <IActionResult> Delete(UserProfileCommentDeleteViewModel viewModel)
        {
            UserProfileComment comment = await userProfileCommentService.GetByIDAsync(viewModel.UserProfileComment.ID);

            if (comment == null)
            {
                return(NotFound());
            }

            await userProfileCommentService.DeleteAsync(comment.ID);

            return(View());
        }
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));
        }
Example #3
0
        public async Task <IActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            UserProfileComment comment = await userProfileCommentService.GetByIDAsync((int)id);

            if (comment == null)
            {
                return(NotFound());
            }

            UserProfileCommentDeleteViewModel viewModel = new UserProfileCommentDeleteViewModel
            {
                UserProfileComment = comment
            };

            return(View(viewModel));
        }
Example #4
0
 public async Task Update([FromBody] UserProfileComment userProfileComment)
 {
     await userProfileCommentService.UpdateAsync(userProfileComment);
 }
Example #5
0
 public async Task Insert([FromBody] UserProfileComment userProfileComment)
 {
     await userProfileCommentService.InsertAsync(userProfileComment);
 }