public async Task <ActionResult> Create() { var departments = await _departmentRepository.GetAllAsync(); var selectListItems = departments.Data.Select(e => new SelectListItem { Text = e.Name, Value = e.Id.ToString() }).ToList(); selectListItems.Add(new SelectListItem { Text = string.Empty, Value = string.Empty, Selected = true }); ViewBag.Departments = selectListItems; return(View(new TaskResult <UsersDto>())); }
public async Task <ActionResult> Create() { var model = new TaskResult <ComplaintsOptionsDto>(); var products = await _productsRepository.GetAllAsync(); ViewBag.Products = products.Data.Select(e => new SelectListItem { Value = e.Id.ToString(), Text = e.Name }).ToList(); var departments = await _departmentsRepository.GetAllAsync(); ViewBag.Departments = departments.Data.Select(e => new SelectListItem { Value = e.Id.ToString(), Text = e.Name }).ToList(); return(View(model)); }
public async Task <List <Department> > GetAllAsync() { var list = await _departmentRepository.GetAllAsync(); return(list.ToList()); }
public async Task <ActionResult> Index() { var model = await _departmentsRepository.GetAllAsync(); return(View(model)); }