public ActionResult AddCar(租车企业._车辆信息 model) { 租车企业 CarInfo = 租车企业管理.查找租车企业(currentUser.Id); if (CarInfo == null) { CarInfo = new 租车企业(); } if (Request.Files.Count == 0) { return Content("<script>alert('请上传车辆图片');window.location='/供应商后台/CompanyWithCar';</script>"); } else { for (int i = 0; i < Request.Files.Count; i++) { HttpPostedFileBase file = Request.Files[i]; if (file != null && file.ContentType == "image/jpeg" && (((file.ContentLength / 1024) / 1024) < 2)) { string filePath = 上传管理.获取上传路径<供应商>(媒体类型.图片, 路径类型.不带域名根路径); string fname = UploadAttachment(file); model.图片.Add(filePath + fname); } } CarInfo.车辆信息.Add(model); 租车企业管理.更新租车企业(CarInfo); return Redirect("/供应商后台/CompanyWithCar"); } }
public ActionResult CompanyWithCar() { List<租车企业> model = 租车企业管理.查询租车企业(0, 0, Query.EQ("所属供应商.用户ID", currentUser.Id)).ToList(); if (model.Count() == 0 || model == null) { 租车企业 m = new 租车企业(); model.Add(m); } return View(model); }