Пример #1
0
        public ActionResult <PlantForCreateDto> CreatePlant([FromBody] PlantForCreateDto plant)
        {
            var plantEntity = _mapper.Map <Entities.Plant>(plant);

            _experimentRepository.AddPlant(plantEntity);
            _experimentRepository.Save();

            var plantToReturn = _mapper.Map <PlantDto>(plantEntity);

            return(CreatedAtRoute("GetPlant",
                                  new { plantId = plantToReturn.Id },
                                  plantToReturn));
        }