public void AddPlant(long id, string friendlyName, string sciName)
 {
     _service.AddPlantAsync(new PlantModel()
     {
         Id             = id,
         FriendlyName   = friendlyName,
         ScientificName = sciName
     });
     Assert.IsTrue(_service.GetPlant(id) != null);
     Assert.IsTrue(_service.PlantExists(id));
 }
Example #2
0
        public async Task <IActionResult> PutPlantModel(long id, PlantModel plantModel)
        {
            if (id != plantModel.Id)
            {
                return(BadRequest());
            }

            if (!await _plantService.EditPlantAsync(plantModel))
            {
                if (!_plantService.PlantExists(id))
                {
                    return(NotFound());
                }
            }

            return(NoContent());
        }