Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 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();
 }
Ejemplo n.º 3
0
        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));
 }
Ejemplo n.º 5
0
 public PlantListItemViewModel(Models.Plant plant)
 {
     this.Id        = plant.Id;
     this.PlantName = plant.PlantName;
 }