Esempio n. 1
0
        public async Task <bool> DeleteAsync(int id)
        {
            var farms = await _farmRepository.GetFarmByTypeIdAsync(new IdRequestFilter <int>
            {
                Id              = id,
                CanGetDeleted   = true,
                CanGetInactived = true
            });

            if (farms.Any())
            {
                throw new CaminoApplicationException($"Some {nameof(farms)} belong to this farm type need to be deleted or move to another farm type");
            }

            return(await _farmTypeRepository.DeleteAsync(id));
        }