public async Task <IActionResult> UpdateVideoPostLikes(int id) { if (id <= 0) { return(NotFound()); } var videoPost = _vpRepository.GetSingle(vc => vc.VideoPostId == id); if (videoPost == null) { return(NotFound()); } else { videoPost.Likes += 1; } _vpRepository.Update(videoPost); await _vpRepository.CommitAsync(); return(new NoContentResult()); }
public async Task <IActionResult> DisableVideoComment(int videoPostId) { if (videoPostId <= 0) { return(NotFound()); } var user = await _userManager.FindByIdAsync(User.Identity.Name); if (user == null) { return(NotFound()); } if (await _userManager.IsInRoleAsync(user, "Admin")) { var videoPost = _vpRepository.GetSingle(vp => vp.VideoPostId == videoPostId); if (videoPost == null) { return(NotFound()); } videoPost.UploaderId = null; videoPost.JobsInDemandId = null; videoPost.IsDisabled = true; _vpRepository.Update(videoPost); await _vpRepository.CommitAsync(); return(new NoContentResult()); } else { return(BadRequest()); } }