public async Task <IActionResult> Index() { var userProfileId = _inkettUserManager.GetProfileId(User); var notCheckedNotifications = await _notificationService.GetNotCheckedNotifications(userProfileId); var viewModels = _notificationViewModelService.GetNotificationsViewModels(notCheckedNotifications); return(View(viewModels)); }
public async Task <IActionResult> FollowProfile(int profileId) { var followerId = _userManager.GetProfileId(User); if (profileId == followerId) { return(NotFound()); } await _profileService.CreateFollow(followerId, profileId); return(Ok()); }
public async Task <IActionResult> Create(AlbumCreateInputModel inputModel) { if (ModelState.IsValid) { var profileId = _userManager.GetProfileId(User); await _albumService.CreateAlbum(profileId, inputModel.Title, inputModel.Description, inputModel.Picture); return(RedirectToAction("Albums", "Profile")); } return(View(inputModel)); }
protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, SameProfileRequirement requirement, IProfileAuthorizable resource) { var profileId = _userManager.GetProfileId(context.User); if (profileId == resource.ProfileId) { context.Succeed(requirement); } return(Task.CompletedTask); }
public async Task <IActionResult> Index(int id) { var tattoo = await _tattooService.GetTattooWithStyles(id); var profileId = _userManager.GetProfileId(User); if (tattoo == null) { return(NotFound()); } var viewModel = _tattooViewModelService.GetTattooIndexViewModel(tattoo, profileId); return(View(viewModel)); }
public async Task <IActionResult> Index(int id) { if (id == 0) { id = _userManager.GetProfileId(User); } var userProfileId = _userManager.GetProfileId(User); var profile = await _profileService.GetProfileWithTattoos(id); if (profile == null) { return(NotFound()); } var profileTattoosViewModel = _profileViewModelService .GetProfileIndexViewModel(profile, _userManager.GetProfileId(User)); return(View(profileTattoosViewModel)); }
public async Task LikeTattoo([FromBody] LikeInputModel likeModel) { var profileId = _userManager.GetProfileId(User); await _tattooService.CreateLike(profileId, likeModel.TattooId); }