示例#1
0
        public async Task AddCropAsync(CropDto cropDto)
        {
            var field = await _repository.GetAsync(cropDto.FieldId);

            if (field == null || field.OrganisationId != cropDto.OrganisationId)
            {
                throw new GreenFieldNotFoundException();
            }
            var crop = _mapper.Map <Crop>(cropDto);

            field.Crops.Add(crop);
            await _repository.UpdateAsync(field);
        }