Example #1
0
        public void Seed()
        {
            #region CreateUser
            var userList = BuildUserList();
            _context.User.AddRange(userList);
            _context.SaveChanges();
            #endregion

            #region CreatePost
            var postList = BuildPostList();
            _context.Post.AddRange(postList);
            _context.SaveChanges();
            #endregion

            #region CreateReservation

            var reservationList = BuildReservationList();
            _context.Reservation.AddRange(reservationList);
            _context.SaveChanges();
            #endregion

            #region CreateRating
            var ratingList = BuildRatingList();
            _context.Rating.AddRange(ratingList);
            _context.SaveChanges();
            #endregion

            #region CreateComment
            var commentList = BuildCommentList();
            _context.Comment.AddRange(commentList);
            _context.SaveChanges();
            #endregion
        }
Example #2
0
        public async Task <Domain.Post.Post> DeletePost(int postId)
        {
            var post = await _context.Post.FirstOrDefaultAsync(x => x.PostId == postId);

            _context.Post.Remove(post);
            _context.SaveChanges();
            return(new Domain.Post.Post(postId));
        }
Example #3
0
        public async Task <Domain.User.User> DeleteUser(int userId)
        {
            var user = await _context.User.FirstOrDefaultAsync(x => x.UserId == userId);

            _context.User.Remove(user);
            _context.SaveChanges();
            return(new Domain.User.User(userId));
        }