Example #1
0
 public override async Task <int> HandleCommand(DeleteCommand request, CancellationToken cancellationToken)
 {
     return(await farmerRepository.Delete(DeleteBuild(new Farmer()
     {
         Id = request.FarmerId
     }, request.LoginSession)));
 }
Example #2
0
        public async Task <bool> DeleteFarmerAsync(int id)
        {
            try
            {
                var entity = await _FarmerRepository.GetEntityByIdAsync(id);

                _FarmerRepository.Delete(entity);
                if (await _uow.SaveChangesAsync() == 1)
                {
                    return(true);
                }
                return(false);
            }
            catch (Exception e)
            {
                throw e;
            }
        }