48 lines
1.3 KiB
C#
48 lines
1.3 KiB
C#
using OSS.Models;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.Mvc;
|
|
|
|
namespace OSS.Repositories
|
|
{
|
|
public class SubSectorsRepository
|
|
{
|
|
public IEnumerable<SelectListItem> GetSubSectors()
|
|
{
|
|
List<SelectListItem> districts = new List<SelectListItem>()
|
|
{
|
|
new SelectListItem
|
|
{
|
|
Value = null,
|
|
Text = " "
|
|
}
|
|
};
|
|
return districts;
|
|
}
|
|
public IEnumerable<SelectListItem> GetSubSectors(string SectorName)
|
|
{
|
|
|
|
using (var _Context = new OSSDBContext())
|
|
{
|
|
List<SelectListItem> countries = _Context.SubSectors.AsNoTracking().Where(t=>t.SectorName==SectorName).OrderBy(t => t.SubSectorName)
|
|
.Select(n =>
|
|
new SelectListItem
|
|
{
|
|
Value = n.SubSectorName,
|
|
Text = n.SubSectorName
|
|
}).ToList();
|
|
|
|
var countrytip = new SelectListItem()
|
|
{
|
|
Value = null,
|
|
Text = "Please Select"
|
|
};
|
|
|
|
|
|
return new SelectList(countries, "Value", "Text");
|
|
}
|
|
}
|
|
}
|
|
} |