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()); }
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)); }
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)); }
public async Task Update([FromBody] UserProfileComment userProfileComment) { await userProfileCommentService.UpdateAsync(userProfileComment); }
public async Task Insert([FromBody] UserProfileComment userProfileComment) { await userProfileCommentService.InsertAsync(userProfileComment); }