コード例 #1
0
ファイル: UserRepository.cs プロジェクト: Herreos/Flyon
        public async Task <int> AddUser(Domain.User.User user)
        {
            var userDAO = new DAO.User {
                Email            = user.Email,
                UserName         = user.UserName,
                Password         = user.Password,
                Gender           = user.Gender,
                BirthDate        = user.BirthDate,
                RegistrationDate = user.CreationDate,
                IsActiveUser     = user.IsActiveUser,
                IsBannedUser     = user.IsBannedUser,
            };
            await _context.AddAsync(userDAO);

            await _context.SaveChangesAsync();

            return(userDAO.UserId);
        }
コード例 #2
0
ファイル: PostRepository.cs プロジェクト: Herreos/Flyon
        public async Task <int> AddPost(Domain.Post.Post post)
        {
            var postDAO = new DAO.Post {
                UserId           = post.UserId,
                CreationDate     = post.CreationDate,
                OfferCountry     = post.OfferCountry,
                OfferCity        = post.OfferCity,
                OfferDescription = post.OfferDescription,
                OfferCost        = post.OfferCost,
                HotelName        = post.HotelName,
                DeparturePlace   = post.DeparturePlace,
                DateOfDeparture  = post.DateOfDeparture,
                DateOfReturn     = post.DateOfReturn,
                IsActivePost     = post.IsActivePost,
                IsBannedPost     = post.IsBannedPost,
                OfferPhotoHref   = post.OfferPhotoHref
            };
            await _context.AddAsync(postDAO);

            await _context.SaveChangesAsync();

            return(postDAO.PostId);
        }