public async Task <IActionResult> Index()
        {
            var userProfileId           = _inkettUserManager.GetProfileId(User);
            var notCheckedNotifications = await _notificationService.GetNotCheckedNotifications(userProfileId);

            var viewModels = _notificationViewModelService.GetNotificationsViewModels(notCheckedNotifications);

            return(View(viewModels));
        }
Beispiel #2
0
        public async Task <IActionResult> FollowProfile(int profileId)
        {
            var followerId = _userManager.GetProfileId(User);

            if (profileId == followerId)
            {
                return(NotFound());
            }
            await _profileService.CreateFollow(followerId, profileId);

            return(Ok());
        }
Beispiel #3
0
        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));
        }
Beispiel #4
0
        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);
        }
Beispiel #5
0
        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));
        }
Beispiel #7
0
 public async Task LikeTattoo([FromBody] LikeInputModel likeModel)
 {
     var profileId = _userManager.GetProfileId(User);
     await _tattooService.CreateLike(profileId, likeModel.TattooId);
 }