public IActionResult Delete(int id)
        {
            using (var context = new RevojiDataContext())
            {
                DBReviewable dbReviewable = context.Get <DBReviewable>(id);
                if (dbReviewable == null)
                {
                    return(new NotFoundResult());
                }

                context.Remove(dbReviewable);
                context.Save();

                return(Ok());
            }
        }
Exemplo n.º 2
0
        public IActionResult Delete()
        {
            using (var context = new RevojiDataContext())
            {
                DBAppUser dbAppUser = context.Get <DBAppUser>(ApiUser.ID);
                if (dbAppUser == null)
                {
                    return(new NotFoundResult());
                }

                context.Remove(dbAppUser);
                context.Save();

                return(Ok());
            }
        }
Exemplo n.º 3
0
        public IActionResult DeleteLike(int id, int appUserId)
        {
            using (var context = new RevojiDataContext())
            {
                DBLike dBLike = context.Likes
                                .Where(l => l.ReviewId == id &&
                                       l.AppUserId == appUserId)
                                .FirstOrDefault();
                if (dBLike == null)
                {
                    return(new NotFoundResult());
                }

                context.Remove(dBLike);
                context.Save();

                return(Ok());
            }
        }
Exemplo n.º 4
0
        public IActionResult RemoveFollowing(int followingId)
        {
            using (var context = new RevojiDataContext())
            {
                var dbFollowing = context.Followings
                                  .Where(f => f.FollowerAppUserId == ApiUser.ID &&
                                         f.FollowingAppUserId == followingId)
                                  .FirstOrDefault();

                if (dbFollowing == null)
                {
                    return(new NotFoundResult());
                }

                context.Remove(dbFollowing);
                context.Save();

                return(Ok(new AppUserFollowing(dbFollowing)));
            }
        }
Exemplo n.º 5
0
        public IActionResult UnblockUser(int blockedId)
        {
            using (var context = new RevojiDataContext())
            {
                var dBBlocking = context.Blockings
                                 .Where(f => f.BlockerAppUserId == ApiUser.ID &&
                                        f.BlockedAppUserId == blockedId)
                                 .FirstOrDefault();

                if (dBBlocking == null)
                {
                    return(new NotFoundResult());
                }

                context.Remove(dBBlocking);
                context.Save();

                return(Ok(new AppUserBlocking(dBBlocking)));
            }
        }