Пример #1
0
        public GardenControllerTest()
        {
            gardenMock  = new Mock <ImyGarden>();
            gardensMock = new List <ImyGarden> {
                gardenMock.Object
            };
            mockRepo = new Mock <IRepoWrapper>();
            garden   = new myGarden();
            gardens  = new List <myGarden>();
            var gardenResultMock = new Mock <IActionResult>();
            var allGardens       = GetGardens();

            gardenController = new GardenController(mockRepo.Object);
        }
Пример #2
0
        public IActionResult Create(AddPlantBindingModel bindingModel)
        {
            var plantToCreate = new myPlant
            {
                Name            = bindingModel.Name,
                DatePlanted     = bindingModel.DatePlanted,
                DateLastWatered = bindingModel.DateLastWatered,
                Garden          = bindingModel.Garden
            };

            var gardenToCreate = new myGarden
            {
                Name = plantToCreate.Garden
            };

            _repo.Gardens.Create(gardenToCreate);


            _repo.Plants.Create(plantToCreate);

            _repo.Save();
            return(RedirectToAction("Plant"));
        }