public ActionResult Edit(int id) { var viewModel = Mapper.Map <Item, ItemViewModel>(SItem.SelectById(id)); viewModel.Items = Mapper.Map <IEnumerable <Category>, IEnumerable <SelectListItem> >(SCategory.GetAllCategories()); return(View(viewModel)); }
public ActionResult Create() { var viewModel = new ItemViewModel { Items = Mapper.Map <IEnumerable <Category>, IEnumerable <SelectListItem> >(SCategory.GetAllCategories()) }; return(View(viewModel)); }