public ActionResult Upload() { int appid = string.IsNullOrEmpty(Request["appid"]) ? 0 : Int32.Parse(Request["appid"]); ViewBag.appid = appid; JMP.BLL.jmp_appsdk bll = new JMP.BLL.jmp_appsdk(); JMP.MDL.jmp_appsdk model = new JMP.MDL.jmp_appsdk(); JMP.BLL.jmp_app bllapp = new JMP.BLL.jmp_app(); JMP.MDL.jmp_app mo = new JMP.MDL.jmp_app(); if (appid > 0) { model = bll.SelectModel(appid); mo = bllapp.GetModel(appid); } ViewBag.model = model == null ? new JMP.MDL.jmp_appsdk() : model; ViewBag.mo = mo == null ? new JMP.MDL.jmp_app() : mo; return(View()); }
public JsonResult InsertOrUpdate(JMP.MDL.jmp_appsdk mo) { object retJson = new { success = 0, msg = "操作失败" }; if (mo.appid > 0) { JMP.BLL.jmp_appsdk bll = new JMP.BLL.jmp_appsdk(); DataTable dt = bll.GetList(" appid='" + mo.appid + "' ").Tables[0]; if (dt.Rows.Count > 0) { mo.id = Int32.Parse(dt.Rows[0]["id"].ToString()); mo.uptimes = DateTime.Now; if (bll.Update(mo)) { retJson = new { success = 1, msg = "上传成功!" }; AddLocLog.AddUserLog(UserInfo.UserId, 3, Request.UserHostAddress, "修改上传应用asdk", "文件名:" + mo.appurl + ",应用id编号:" + mo.appid); } else { retJson = new { success = 0, msg = "上传失败!" }; } } else { mo.uptimes = DateTime.Now; int cg = bll.Add(mo); if (cg > 0) { retJson = new { success = 1, msg = "上传成功!" }; AddLocLog.AddUserLog(UserInfo.UserId, 3, Request.UserHostAddress, "上传应用asdk", "文件名:" + mo.appurl + ",应用id编号:" + mo.appid); } else { retJson = new { success = 0, msg = "上传失败!" }; } } } return(Json(retJson)); }