public async Task <IEnumerable <InsureeModel> > GetInsureeByFamilyIdAsync(int familyId) { IEnumerable <InsureeModel> insureeList; using (var imisContext = new ImisDB()) { insureeList = await(from i in imisContext.TblInsuree where i.FamilyId == familyId && i.ValidityTo == null select InsureeModel.FromTblInsuree(i)) .ToListAsync(); } return(insureeList); }
public async Task <InsureeModel> GetInsureeByCHFIDAsync(string chfId) { InsureeModel insuree; using (var imisContext = new ImisDB()) { insuree = await(from i in imisContext.TblInsuree where i.Chfid == chfId && i.ValidityTo == null select InsureeModel.FromTblInsuree(i)) .FirstOrDefaultAsync(); } return(insuree); }
public async Task ValidateAsync(Object input) { validator?.Validate(input); string insureeNumber = (string)input; if (insureeNumber.Length == 0) { throw new ValidationException(InsureeErrors.MISSING_INSUREE_NUMBER_ERROR); } InsureeModel insuree = await this.insureeLogic.GetInsureeByInsureeIdAsync(insureeNumber); if (insuree != null) { throw new ValidationException(InsureeErrors.INSUREE_NUMBER_EXISTS_ERROR, null, insureeNumber); } }