// // GET: /XM_RZ/Create public ActionResult Create(string notice_type) { var member = CurrentMember(); if (member == null) { return RedirectToAction("Login", "Member"); } if (notice_type == "success") { ViewData["notice"] = "融资项目发布成功,可进入我的发布中查阅!"; } BindOptions(); var t_xm_financing = new T_XM_Financing(); if (t_xm_financing.ValidDate == DateTime.MaxValue) t_xm_financing.ValidDate = DateTime.Now; return View(t_xm_financing); }
public ActionResult Create(T_XM_Financing t_xm_financing, FormCollection collection) { var member = CurrentMember(); if (member == null) { return RedirectToAction("Login", "Member"); } BindOptions(); if (ModelState.IsValid) { string checkedTransactionMode = (collection["TransactionMode"] + ",").Replace("false,", ""); if (checkedTransactionMode.Length > 1) checkedTransactionMode = checkedTransactionMode.Remove(checkedTransactionMode.Length - 1); t_xm_financing.TransactionMode = checkedTransactionMode == "," ? "" : checkedTransactionMode; t_xm_financing.City = collection["ddlCity"]; t_xm_financing.ItemContent = t_xm_financing.ItemContent == null ? "" : t_xm_financing.ItemContent; t_xm_financing.IsValid = true; t_xm_financing.OP = 0; t_xm_financing.CreateTime = DateTime.Now; t_xm_financing.UpdateTime = DateTime.Now; t_xm_financing.SubmitTime = DateTime.Now; t_xm_financing.MemberID = CurrentMember().ID; db.T_XM_Financing.Add(t_xm_financing); db.SaveChanges(); Logging("发布了新的融资项目--" + t_xm_financing.ItemName, (int)OperateTypes.Create, (int)GenerateSystem.Publish); return RedirectToAction("Create", new { notice_type = "success" }); } ViewData["error"] = "融资项目发布失败!请检查输入信息或联系我们!"; return View(t_xm_financing); }
// // GET: /XM_RZ/Create public ActionResult Create() { BindArea(); BindIndustry(); BindFinancType(); BindItemStage(); BindAssetsType(); BindTransactionMode(); BindCooperationMode(); var t_xm_financing = new T_XM_Financing(); return View(t_xm_financing); }
public ActionResult Edit(T_XM_Financing t_xm_financing, FormCollection collection) { var member = CurrentMember(); if (member == null) { return RedirectToAction("Login", "Member"); } if (ModelState.IsValid) { db.Entry(t_xm_financing).State = EntityState.Modified; string checkedTransactionMode = (collection["TransactionMode"] + ",").Replace("false,", ""); if (checkedTransactionMode.Length > 1) checkedTransactionMode = checkedTransactionMode.Remove(checkedTransactionMode.Length - 1); t_xm_financing.TransactionMode = checkedTransactionMode == "," ? "" : checkedTransactionMode; t_xm_financing.City = collection["ddlCity"]; t_xm_financing.ItemContent = t_xm_financing.ItemContent == null ? "" : t_xm_financing.ItemContent; t_xm_financing.UpdateTime = DateTime.Now; db.SaveChanges(); Logging("更新了融资项目--" + t_xm_financing.ItemName, (int)OperateTypes.Edit, (int)GenerateSystem.Publish); return RedirectToAction("Edit", new { notice_type = "success" }); } ViewData["error"] = "融资项目更新失败!请检查输入信息或联系我们!"; return View(t_xm_financing); }
public ActionResult Edit(T_XM_Financing t_xm_financing, FormCollection collection) { if (ModelState.IsValid) { db.Entry(t_xm_financing).State = EntityState.Modified; string checkedTransactionMode = (collection["TransactionMode"] + ",").Replace("false,", ""); if (checkedTransactionMode.Length > 1) checkedTransactionMode = checkedTransactionMode.Remove(checkedTransactionMode.Length - 1); t_xm_financing.TransactionMode = checkedTransactionMode == "," ? "" : checkedTransactionMode; t_xm_financing.City = collection["ddlCity"]; t_xm_financing.ItemContent = t_xm_financing.ItemContent == null ? "" : t_xm_financing.ItemContent; t_xm_financing.UpdateTime = DateTime.Now; HttpPostedFileBase file = Request.Files[0]; //存入文件 if (file.ContentLength > 0) { t_xm_financing.Pic = new byte[Request.Files[0].InputStream.Length]; Request.Files[0].InputStream.Read(t_xm_financing.Pic, 0, t_xm_financing.Pic.Length); } int result = db.SaveChanges(); if (result > 0) return ReturnJson(true, "操作成功", "", "", true, ""); else return ReturnJson(false, "操作失败", "", "", false, ""); } return Json(new { }); }