public ActionResult Create() { List <StatusForList> types = new List <StatusForList>(); foreach (Type item in typeService.GetAll()) { types.Add(new StatusForList { Key = item.ID.ToString(), Display = item.Description }); } List <CheckboxItem> admissions = new List <CheckboxItem>(); foreach (var item in admissionService.GetAll()) { string display = item.Role + " (" + item.Description + ")"; admissions.Add(new CheckboxItem() { ID = item.ID, Display = display, IsChecked = false }); } CheckpointViewModel model = new CheckpointViewModel { StatusList = new SelectList(new List <StatusForList> { new StatusForList { Key = "Пропуск", Display = "Пропуск" }, new StatusForList { Key = "Отметка", Display = "Отметка" } }, "Key", "Display"), TypeList = new SelectList(types, "Key", "Display"), AdmissionList = admissions }; return(View(model)); }
// GET api/admissions /// <summary> /// Gets all <see cref="Admission"/> from repository. /// </summary> /// <returns>The collection of all <see cref="Admission"/> from the repository.</returns> public IHttpActionResult Get() { IEnumerable <Admission> items = service.GetAll(); if (items != null) { return(Ok(items)); } else { return(NotFound()); } }
public void Get_All() { //Arrange unitWorkMoq.Setup(x => x.Admission.GetAll()).Returns(itemsAdmission); //Act var result = serviceMock.GetAll(); //Assert Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(List <Admission>)); Assert.AreEqual(2, result.Count()); }
public ActionResult Index() { return(View(service.GetAll())); }