/// <summary> /// 校区 /// </summary> /// <returns></returns> public ActionResult Campus(int id = 0) { Campus model = _campusService.GetByIdAsync(id); if (model == null) { throw new Exception("校区不存在"); } ViewBag.Imgs = _campusService.GetImgsByCampusIdAsync(id) ?? new List <CampusImg>(); ViewBag.Student = _studentService.GetListByCampusAsync(id, 4); return(View(model)); }
public ActionResult Edit(int id = 0) { Campus model = new Campus(); string action = "添加校区"; if (id > 0) { model = _campusService.GetByIdAsync(id); action = "修改校区"; } ViewBag.Action = action; return(View(model)); }