/// <summary> /// Listar categorias para generar el modelo que luego /// se lo paso a la vista para que la muestre /// </summary> /// <returns></returns> public ActionResult Index() { var biz = new CategoryBiz(); var model = biz.List(); return(View(model)); }
public ActionResult Create() { var categoryBiz = new CategoryBiz(); List <Category> categoryList = (from c in categoryBiz.List() select new Category { Id = c.Id, Name = c.Name }).ToList(); List <SelectListItem> categories = categoryList.ConvertAll(c => { return(new SelectListItem() { Text = c.Name.ToString(), Value = c.Id.ToString(), Selected = false }); }); ViewBag.items = categories; return(View()); }