HoneyBadgerBusinessLayer.HoneyBadgerSvc.LoadIncidentTypes C# (CSharp) Method

LoadIncidentTypes() public method

public LoadIncidentTypes ( ) : IEnumerable
return IEnumerable
        public IEnumerable<string> LoadIncidentTypes()
        {
            using (var context = new HoneyBadgerEntities())
            {

                var stateDisasters = from sd in context.StateDisasterViews
                                     select sd;

                if (stateDisasters.Count() > 0)
                    return stateDisasters.Select<StateDisasterView, string>(x => x.DisasterType).Distinct().OrderBy(x => x).ToList();

            }
            //defaults to two incident types to keep the feel of the UI
            return new List<string> { "Flood", "Severe Ice Storm" };
        }

Usage Example

 public ActionResult Index()
 {
     HoneyBadgerSvc service = new HoneyBadgerSvc();
     HomeLookupViewModel model = new HomeLookupViewModel();
     model.IncidentYears = service.LoadIncidentYears();
     model.IncidentTypes = service.LoadIncidentTypes();
     return View(model);
 }