public ActionResult Add() { var roles = roleService.GetAll(); AdminUserAddViewModel model = new AdminUserAddViewModel(); //model.Cities = cities.ToArray(); model.Roles = roles; return(View(model)); }
public ActionResult Add() { var cities = cityService.GetAll().ToList(); cities.Insert(0, new DTO.CityDTO { Id = 0, Name = "总部" }); var roles = roleService.GetAll(); AdminUserAddViewModel model = new AdminUserAddViewModel(); model.Cities = cities.ToArray(); model.Roles = roles; return(View(model)); }
public ActionResult Add() { //取得所有的城市 var cities = cityService.GetAll().ToList(); //在cities(insert只能插入list中)最前面插入一个总部 cities.Insert(0, new DTO.CityDTO { Id = 0, Name = "总部" }); //取得所有的角色 var roles = roleService.GetAll(); AdminUserAddViewModel model = new AdminUserAddViewModel(); model.Cities = cities.ToArray(); model.Roles = roles; return(View(model)); }
public ActionResult Add() { var cities = cityService.GetAll().ToList(); //在城市的最前面加一个总部,转为list数组之后才可以添加 //insert只有list才支持,getall返回的是数组 cities.Insert(0, new DTO.CityDTO { Id = 0, Name = "总部" }); var roles = roleService.GetAll(); AdminUserAddViewModel model = new AdminUserAddViewModel(); model.Cities = cities.ToArray(); model.Roles = roles; return(View(model)); }