コード例 #1
0
ファイル: PlantController.cs プロジェクト: sanket2611/Esuite
        public async Task <IActionResult> Create([FromBody] Plant plant)
        {
            if (_plantService.IsExisting(plant))
            {
                return(StatusCode((int)HttpStatusCode.Conflict));
            }

            _repository.Add(plant);
            _repository.Save();

            await _plantService.PublishSaveEventAsync(plant);

            return(CreatedAtRoute("GetPlant", new { id = plant.Id }, Mapper.Map <Plant, PlantGetDto>(plant)));
        }