示例#1
0
        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);
        }
示例#2
0
        private IEnumerable <DAO.Post> BuildPostList()
        {
            var postList = new List <DAO.Post>();
            var post1    = new DAO.Post()
            {
                UserId           = 1,
                CommentsCount    = 2,
                RatesCount       = 4,
                AverangeRate     = 4.5,
                CreationDate     = new DateTime(2020, 03, 03, 10, 14, 55),
                EditionDate      = new DateTime(2020, 03, 03, 10, 14, 55),
                OfferDescription = "Należący do naszej własnej sieci hoteli - White Olive Elite Rethymno to miejsce, gdzie najlepiej możemy zadbać o naszych Klientów.",
                OfferCountry     = "Grecja",
                OfferCity        = "Chania",
                OfferCost        = 3722.00,
                OfferPhotoHref   = "//images.r.pl/zdjecia/hotele/glob/4985/white-olive-elite-rethymno_grecja_kreta-chania_4985_118956_251548_1920x730.jpg",
                HotelName        = "White Olive Elite Rethymno",
                DeparturePlace   = "Lotnisko - Katowice",
                DateOfDeparture  = new DateTime(2020, 07, 05, 08, 45, 00),
                DateOfReturn     = new DateTime(2020, 07, 12, 07, 30, 00),
                IsActivePost     = true,
                IsBannedPost     = false
            };

            postList.Add(post1);

            var post2 = new DAO.Post()
            {
                UserId           = 1,
                CommentsCount    = 3,
                RatesCount       = 3,
                AverangeRate     = 4.0,
                CreationDate     = new DateTime(2020, 04, 02, 09, 45, 01),
                EditionDate      = new DateTime(2020, 04, 02, 09, 45, 01),
                OfferDescription = "11 basenów, prywatna plaża z turkusowym wybrzeżem, komfortowo zaprojektowane pokoje, bogaty program dziennych i wieczornych animacji - to wszystko sprawi, że to będę Twoje niezapomniane, błogie wakacje!",
                OfferCountry     = "Turcja",
                OfferCity        = "Riwiera Turecka",
                OfferCost        = 4507.00,
                OfferPhotoHref   = "//images.r.pl/zdjecia/hotele/glob/4813/waterworld-belek-by-mp-hotels_turcja_riwiera-turecka_4813_121458_259605_1920x730.jpg",
                HotelName        = "Aquaworld Belek By MP Hotels",
                DeparturePlace   = "Lotnisko - Rzeszów",
                DateOfDeparture  = new DateTime(2020, 07, 15, 09, 15, 00),
                DateOfReturn     = new DateTime(2020, 07, 22, 10, 00, 00),
                IsActivePost     = true,
                IsBannedPost     = false
            };

            postList.Add(post2);

            var post3 = new DAO.Post()
            {
                UserId           = 1,
                CommentsCount    = 1,
                RatesCount       = 2,
                AverangeRate     = 4.0,
                CreationDate     = new DateTime(2020, 01, 01, 07, 30, 13),
                EditionDate      = new DateTime(2020, 01, 01, 07, 30, 13),
                OfferDescription = "Wypoczynek w słonecznej Hurghdzie! Hotel all inclusive z siedmioma basenami oraz z wieloma ciekawymi miejscami turystycznymi wokół.",
                OfferCountry     = "Egipt",
                OfferCity        = "Hurghda",
                OfferCost        = 3278.00,
                OfferPhotoHref   = "//images.r.pl/zdjecia/hotele/glob/1416/symbole-egiptu-nil-i-piramidy_1416_99888_145205_1920x730.jpg",
                HotelName        = "Hurghda Hotel",
                DeparturePlace   = "Lotnisko - Katowice",
                DateOfDeparture  = new DateTime(2020, 07, 16, 05, 15, 00),
                DateOfReturn     = new DateTime(2020, 07, 24, 13, 30, 00),
                IsActivePost     = true,
                IsBannedPost     = false
            };

            postList.Add(post3);

            return(postList);
        }