public List <BenefitView> GetAllBenefits() { using (var bus = new BenefitRepository()) { return(bus.GetAll().Select(x => new BenefitView() { benefitID = x.benefitID, Name = x.Name, }).ToList()); } }
public BenefitView GetBenefitByName(string name) { using (var b = new BenefitRepository()) { var model = new BenefitView(); foreach (Benefit ben in b.GetAll()) { if (ben.Name == name) { model.benefitID = ben.benefitID; model.Name = ben.Name; } } return(model); } }