/// <summary> /// here&more /// </summary> /// <returns></returns> public ActionResult HereAndMore() { Copys copys = _copysService.GetInfoAsync(); ViewBag.Copy = copys == null ? "" : copys.HereMoreCopy; ViewBag.CountryList = EnumberHelper.EnumToList <EnumCountry>(); ViewBag.MajorList = _majorService.GetAllAsync(); return(View()); }
public bool UpdateAsync(Copys model) { if (model == null) { throw new ArgumentNullException("model不能为null"); } return(_copysRepository.UpdateAsync(model)); }
public ActionResult Index() { Copys model = _copysService.GetInfoAsync(); if (model == null) { model = new Copys(); } return(View(model)); }
/// <summary> /// 实习预约 /// </summary> /// <returns></returns> public ActionResult CompanyApply(int id = 0) { if (id == 0) { throw new Exception("实习单位不存在"); } ViewBag.CompanyId = id; Copys copys = _copysService.GetInfoAsync(); ViewBag.Copy = copys == null ? "" : copys.CompanyApplyCopy; ViewBag.CountryList = EnumberHelper.EnumToList <EnumCountry>(); ViewBag.MajorList = _majorService.GetAllAsync(); return(View()); }
public bool InsertAsync(Copys model) { using (var conn = DapperFactory.GetConnection()) { var fields = model.ToFields(); if (fields == null || fields.Count == 0) { return(false); } string sql = string.Format("insert into [Copys] ({0}) values ({1});", string.Join(",", fields), string.Join(",", fields.Select(n => "@" + n))); return(conn.Execute(sql, model) > 0); } }
/// <summary> /// 课程预约 /// </summary> /// <returns></returns> public ActionResult CourseOrder(int id = 0) { if (id == 0) { throw new Exception("课程不存在"); } //课程预约文案 Copys copys = _copysService.GetInfoAsync(); ViewBag.Copy = copys == null ? "" : copys.CourseApplyCopy; ViewBag.CourseId = id; ViewBag.CountryList = EnumberHelper.EnumToList <EnumCountry>(); ViewBag.MajorList = _majorService.GetAllAsync(); return(View()); }
public bool UpdateAsync(Copys model) { using (var conn = DapperFactory.GetConnection()) { var fields = model.ToFields(); if (fields == null || fields.Count == 0) { return(false); } var fieldList = new List <string>(); foreach (var field in fields) { fieldList.Add(string.Format("{0}=@{0}", field)); } string sql = string.Format("update [Copys] set {0};", string.Join(",", fieldList)); return(conn.Execute(sql, model) > 0); } }
public JsonResult Set(Copys model) { if (model == null) { return(Error("参数错误。")); } var result = new ResultBase(); int count = _copysService.GetCountAsync(); if (count > 0) { result.success = _copysService.UpdateAsync(model); } else { result.success = _copysService.InsertAsync(model); } return(Json(result)); }