public async Task <Result <List <WardLookup> > > Handle(GetWardCommand request, CancellationToken cancellationToken) { try { LookupLogic ll = new LookupLogic(_unitOfWork); var wards = await ll.GetWardList(request.SubcountyId); return(Result <List <WardLookup> > .Valid(wards)); } catch (Exception e) { Log.Error(e.Message + " " + e.InnerException); return(Result <List <WardLookup> > .Invalid(e.Message)); } }
public async Task <Result <AddWardListReponse> > Handle(GetWardCommand request, CancellationToken cancellationToken) { try { LookupLogic ll = new LookupLogic(_unitOfWork); if (String.IsNullOrEmpty(request.CountyId)) { CountyId = 0; } else { CountyId = Convert.ToInt32(request.CountyId); } if (String.IsNullOrEmpty(request.SubcountyId)) { SubCountyId = 0; } else { SubCountyId = Convert.ToInt32(request.SubcountyId); } if (CountyId == 0 && SubCountyId > 0) { wards = await ll.GetWardList(SubCountyId); } return(Result <AddWardListReponse> .Valid(new AddWardListReponse() { Wards = wards })); } catch (Exception e) { return(Result <AddWardListReponse> .Invalid(e.Message)); } }