|
| 1 | +using CarvedRock.Api.Data.Entities; |
| 2 | +using System; |
| 3 | +using System.Collections.Generic; |
| 4 | +using System.Linq; |
| 5 | + |
| 6 | +namespace CarvedRock.Api.Data |
| 7 | +{ |
| 8 | + public static class InitialData |
| 9 | + { |
| 10 | + public static void Seed(this CarvedRockDbContext dbContext) |
| 11 | + { |
| 12 | + if (!dbContext.Products.Any()) |
| 13 | + { |
| 14 | + dbContext.Products.Add(new Product |
| 15 | + { |
| 16 | + Name = "Mountain Walkers", |
| 17 | + Description = "Use these sturdy shoes to pass any mountain range with ease.", |
| 18 | + Price = 219.5m, |
| 19 | + Rating = 4, |
| 20 | + Type = ProductTypeEnum.Boots, |
| 21 | + Stock = 12, |
| 22 | + PhotoFileName = "shutterstock_66842440.jpg", |
| 23 | + IntroducedAt = DateTimeOffset.Now.AddMonths(-1), |
| 24 | + ProductReviews = new List<ProductReview> |
| 25 | + { |
| 26 | + new ProductReview |
| 27 | + { |
| 28 | + Title = "Crossed the Himalayas", |
| 29 | + Review = "First released almost 30 years ago, the Titan 26078 is a classic work boot. It’s also one of Timberland’s all time best sellers." |
| 30 | + }, |
| 31 | + new ProductReview |
| 32 | + { |
| 33 | + Title = "Comfortable", |
| 34 | + Review = "One of the most comfortable hiking boots available, each pair comes complete with the Power Fit Comfort System, designed to offer maximum support at key areas of your feet." |
| 35 | + } |
| 36 | + } |
| 37 | + }); |
| 38 | + |
| 39 | + dbContext.Products.Add(new Product |
| 40 | + { |
| 41 | + Name = "Army Slippers", |
| 42 | + Description = "For your everyday marches in the army.", |
| 43 | + Price = 125.9m, |
| 44 | + Rating = 3, |
| 45 | + Type = ProductTypeEnum.Boots, |
| 46 | + Stock = 56, |
| 47 | + PhotoFileName = "shutterstock_222721876.jpg", |
| 48 | + IntroducedAt = DateTimeOffset.Now.AddMonths(-1), |
| 49 | + ProductReviews = new List<ProductReview> |
| 50 | + { |
| 51 | + new ProductReview |
| 52 | + { |
| 53 | + Title = "Indestructible", |
| 54 | + Review = "They have absolutely no break in period and can literally be worn to work the day that you get them." |
| 55 | + }, |
| 56 | + new ProductReview |
| 57 | + { |
| 58 | + Title = "Safety toe", |
| 59 | + Review = "The safety toe is made from an aluminium alloy which offers all the protection of steel but half the weight. The soles are also oil, abrasion and slip resistant." |
| 60 | + } |
| 61 | + } |
| 62 | + }); |
| 63 | + |
| 64 | + dbContext.Products.Add(new Product |
| 65 | + { |
| 66 | + Name = "Backpack Deluxe", |
| 67 | + Description = "This backpack can survive any tornado.", |
| 68 | + Price = 199.99m, |
| 69 | + Rating = 5, |
| 70 | + Type = ProductTypeEnum.ClimbingGear, |
| 71 | + Stock = 66, |
| 72 | + PhotoFileName = "shutterstock_6170527.jpg", |
| 73 | + IntroducedAt = DateTimeOffset.Now.AddMonths(-1), |
| 74 | + ProductReviews = new List<ProductReview> |
| 75 | + { |
| 76 | + new ProductReview |
| 77 | + { |
| 78 | + Title = "Feels like canvas", |
| 79 | + Review = "The Better Backpack is made from 100% recycled plastic but looks and feels like canvas. We were sent the grey bag with the tan leather accents and silver zippers. I’ve personally always liked tan leather paired with the color grey and appreciate the feel of the leather pull tabs and handles at the top of the bag. Additionally the inside is navy blue with a diagonal stitch pattern which gives it an air of sophistication." |
| 80 | + } |
| 81 | + |
| 82 | + } |
| 83 | + }); |
| 84 | + |
| 85 | + dbContext.Products.Add(new Product |
| 86 | + { |
| 87 | + Name = "Climbing Kit", |
| 88 | + Description = "Anything you need to climb the mount Everest.", |
| 89 | + Price = 299.5m, |
| 90 | + Rating = 5, |
| 91 | + Type = ProductTypeEnum.ClimbingGear, |
| 92 | + Stock = 3, |
| 93 | + PhotoFileName = "shutterstock_48040747.jpg", |
| 94 | + IntroducedAt = DateTimeOffset.Now.AddMonths(-1) |
| 95 | + }); |
| 96 | + |
| 97 | + dbContext.Products.Add(new Product |
| 98 | + { |
| 99 | + Name = "Blue Racer", |
| 100 | + Description = "Simply the fastest kayak on earth and beyond for 2 persons.", |
| 101 | + Price = 350m, |
| 102 | + Rating = 5, |
| 103 | + Type = ProductTypeEnum.Kayaks, |
| 104 | + Stock = 8, |
| 105 | + PhotoFileName = "shutterstock_441989509.jpg", |
| 106 | + IntroducedAt = DateTimeOffset.Now.AddMonths(-1), |
| 107 | + ProductReviews = new List<ProductReview> |
| 108 | + { |
| 109 | + new ProductReview |
| 110 | + { |
| 111 | + Title = "So this is my 1st ever...", |
| 112 | + Review = "So this is my 1st ever kayak and my 1st experience paddling a kayak. I struggled with whether I should spend more money to buy a \"Fishing\" kayak, or even a \"higher end\" kayak because my fear was paddling around a bathtub on the lake. I have to say, I love this kayak for me. It doesn\'t have a lot of the bells and whistles that some of the pricier kayaks have but, I\'m not disappointed.\r\n\r\nIt\'s pretty bare bones aside from some dry storage areas and some bungees. It does have a bungee to hold your paddle on the side. I feel it paddles very easy. It goes exactly where I want it to, I didn\'t struggle to keep it on course. A stiff wind can knock you off track but it was very sturdy and I feel like it would take a lot to tip it over. I stayed fairly dry aside from the dripping off the paddle but its a sit on top so thats to be expected." |
| 113 | + }, |
| 114 | + new ProductReview |
| 115 | + { |
| 116 | + Title = "Great for all genders", |
| 117 | + Review = "I am a fit 5'7 woman 140lbs and I take my 30# dog along with no troubles. I have fished with it by using a bucket strapped in the back with my bungee cords. It holds my rods and small tackle tray, bug spray etc so I can get to it all easily. I can even get it up on the roof of my jeep alone. " |
| 118 | + }, |
| 119 | + new ProductReview |
| 120 | + { |
| 121 | + Title = "Happy", |
| 122 | + Review = "Very happy with my purchase and I recommend this to anyone who doesn't want to spend over 600$ on a kayak but also doesn't want a cheap ole hunk of plastic. " |
| 123 | + } |
| 124 | + } |
| 125 | + }); |
| 126 | + |
| 127 | + dbContext.Products.Add(new Product |
| 128 | + { |
| 129 | + Name = "Orange Demon", |
| 130 | + Description = "One person kayak with hyper boost button.", |
| 131 | + Price = 450m, |
| 132 | + Rating = 2, |
| 133 | + Type = ProductTypeEnum.Kayaks, |
| 134 | + Stock = 1, |
| 135 | + PhotoFileName = "shutterstock_495259978.jpg", |
| 136 | + IntroducedAt = DateTimeOffset.Now.AddMonths(-1), |
| 137 | + ProductReviews = new List<ProductReview> |
| 138 | + { |
| 139 | + new ProductReview { |
| 140 | + Title = "Hobie took the paddle out", |
| 141 | + Review = "Hobie took the paddle out of the hands of the masses, and changed kayak fishing forever. Ive heavily fished the \'Revo\' since 2011 and feel its about perfect for my use. As a serious cyclist its a natural fit, and it can cover huge distances. The torque the Mirage drive generates in rough conditions is often overlooked. I feel it could easily pull any propeller driven kayak backwards in a tug-o-war. I recently weighed my bare hull at 69#s, and that\'s not too shabby for ANY pedal yak. I still fish from paddle yaks, but I spend more time with the rods in my hands when on the Revo." |
| 142 | + } |
| 143 | + } |
| 144 | + }); |
| 145 | + |
| 146 | + dbContext.SaveChanges(); |
| 147 | + } |
| 148 | + } |
| 149 | + } |
| 150 | +} |
0 commit comments