/// <summary> /// Gets the name of the benefit by. /// </summary> /// <param name="benefitName">Name of the benefit.</param> /// <param name="companyId">The company identifier.</param> /// <returns></returns> /// <exception cref="System.ApplicationException">e</exception> public IBenefit GetBenefitByName(string benefitName, int companyId) { try { using ( var dbContext = (HRMSEntities)this.dbContextFactory.GetDbContext(ObjectContextType.HRMS)) { var aRecord = BenefitQueries.getBenefitByName(dbContext, benefitName, companyId); return(aRecord); } } catch (Exception e) { throw new ApplicationException(nameof(e)); } }
/// <summary> /// Gets the benefit by company identifier identifier. /// </summary> /// <param name="companyId">The company identifier.</param> /// <returns></returns> /// <exception cref="ApplicationException">GetBenefitById</exception> public IList <IBenefit> GetBenefitByCompanyId(int companyId) { try { using ( var dbContext = (HRMSEntities)this.dbContextFactory.GetDbContext(ObjectContextType.HRMS)) { var result = BenefitQueries.getBenefitByCompanyId(dbContext, companyId).ToList(); return(result); } } catch (Exception e) { throw new ApplicationException("GetBenefitById ", e); } }