// GET: api/Titles public IEnumerable <Title> GetAll() { using (TitleService titleService = new TitleService(new DataContext())) { return(titleService.GetAll()); } }
public void GetAll_Test() { // Arrange TestKolgraphEntities context = new TestKolgraphEntities(); var repository = new TitleRepository(context); var service = new TitleService(repository); // Act IEnumerable <TitleModel> result = service.GetAll(); // Assert Assert.IsNotNull(result); Assert.AreEqual(context.title.Count(), result.Count()); }
public static IEnumerable <SelectListItem> FillddlTitle() { var service = new TitleService(); var titles = service.GetAll(); var listitems = titles.Select(x => new SelectListItem { Text = x.TitleName, Value = x.Id.ToString() }); return(listitems); }
public static IEnumerable<SelectListItem> FillddlTitle() { var service = new TitleService(); var titles = service.GetAll(); var listitems = titles.Select(x => new SelectListItem { Text = x.TitleName, Value = x.Id.ToString() }); return listitems; }
// GET: Titles public ActionResult Index() { var titles = Service.GetAll(); return(View(titles)); }