public PlantDetailsViewModel(Models.Plant plant) { this.Id = plant.Id; this.PlantName = plant.PlantName; this.Category = plant.PlantCategory; this.PlantTime = plant.PlantTime; this.HarvestTime = plant.HarvestTime; this.Sun = this.Sun; this.Spacing = this.Spacing; this.Duration = plant.Duration; this.MaxTemp = plant.MaxTemp; this.MinTemp = plant.MinTemp; }
public void Persist(ApplicationDbContext context) { Models.Plant plant = new Models.Plant { PlantName = this.PlantName, PlantCategory = this.Category, PlantTime = this.PlantTime, HarvestTime = this.HarvestTime, Sun = this.Sun, Spacing = this.Spacing, Duration = this.Duration, MaxTemp = this.MaxTemp, MinTemp = this.MinTemp }; context.Add(plant); context.SaveChanges(); }
public IActionResult Add(AddViewModel newPlant) { Plant addPlant = new Models.Plant { Name = newPlant.Name, Seeded = newPlant.Seeded, Ready = newPlant.Ready, Price = newPlant.Price }; context.Plants.Add(addPlant); context.SaveChanges(); return(Redirect("/")); }
public bool HasCollectedPlant(Models.Plant plant) { return(UserPlantCollection.Contains(plant)); }
public PlantListItemViewModel(Models.Plant plant) { this.Id = plant.Id; this.PlantName = plant.PlantName; }