public async Task <ActionResult> AppDownloadListAsync(FormCollection fc) { HttpPostedFileBase file = Request.Files["appPath"]; if (file != null) { AppDownloadCount adc = new AppDownloadCount() { ArticleTitle = fc["apptitle"], Channel = fc["appchannel"], Creator = User.Identity.Name, AppUrl = "", OtherChannel = fc["otherSpread"] }; int pkid = new SemCampaignHandler(DbScopeManager).CreateApp(adc); try { var str = await SaveFileAsync(file); if (str.Success) { new SemCampaignHandler(DbScopeManager).CreateOrDeleteApp(imgUrl + str.Result, pkid); } else { //没有更新成功,把之前新增的记录删除 var wew = new SemCampaignHandler(DbScopeManager).CreateOrDeleteApp("", pkid); } } catch (Exception ex) { new SemCampaignHandler(DbScopeManager).CreateOrDeleteApp("", pkid); return(Json(ex.Message)); } return(RedirectToAction("Index")); } else { return(Json("没有获取到上传文件,请返回重新提交!")); } }
/// <summary> /// 获取下载记录 /// </summary> /// <param name="id"></param> /// <returns></returns> public JsonResult GetHistory(int id) { var ss = new SemCampaignHandler(DbScopeManager).AppDownloadActionList(id); return(Json(ss, JsonRequestBehavior.AllowGet)); }