public Car(string model, CarCondition carCondition, string body, int releaseYear) { _model = model; _condition = carCondition; _body = body; _releaseYear = releaseYear; }
public async Task <IActionResult> CreateData() { // Add sample data like colours and conditions var blackColor = new CarColour { ColorName = "black" }; var redColor = new CarColour { ColorName = "red" }; var whiteColor = new CarColour { ColorName = "white" }; var greenColor = new CarColour { ColorName = "green" }; var addColorsToList = new List <CarColour> { blackColor, redColor, whiteColor, greenColor }; _context.Colours.AddRange(addColorsToList); var newCondition = new CarCondition { Condition = "New" }; var secondHandCondition = new CarCondition { Condition = "Second hand" }; // create roles and add administrator user await _roleManager.CreateAsync(new IdentityRole("Administrator")); await _roleManager.CreateAsync(new IdentityRole("User")); var user = new IdentityUser { UserName = "******", Email = "*****@*****.**" }; var result = await _userManager.CreateAsync(user, "Administrator@123"); if (result.Succeeded) { await _userManager.AddToRoleAsync(user, "User"); await _userManager.AddToRoleAsync(user, "Administrator"); } _context.SaveChanges(); return(View()); }
public Car(CarCondition carCondition) { _condition = carCondition; }