public ActionResult Add(SystemAdminRegister sa, string CheckRoleIds) { if (!Request.IsAjaxRequest()) { return(Content("操作失败,你的浏览器禁用了Javascript脚本!")); } ShowResultModel srm = new ShowResultModel(); if (ModelState.IsValid) { try { SystemAdmin sad = new SystemAdmin() { Email = sa.Email, SANickName = sa.SANickName, SAName = sa.SAName, SAPwd = StrUtil.EncryptPassword(sa.Password, "MD5"), SASex = sa.SASex, SAMobileNo = sa.SAMobileNo, LoginTimes = 0, CurrentIP = "未登录", LastIP = "未登录", IsEnable = sa.IsEnable }; _sysadminService.AddSysAdmin(sad, CheckRoleIds); srm.TipMsg = "新增管理员成功!<br/><br/><input type='button' class='box-buttonadd' value='继续添加' onclick='window.document.getElementById("lhgfrm_divaddSysAdmin").contentWindow.Goon();'/><input type='button' class='box-buttonclose' value='取消' onclick='window.document.getElementById("lhgfrm_divaddSysAdmin").contentWindow.Undo()'/>"; srm.IsSuccess = true; } catch (InvalidOperationException ex) { srm.TipMsg = ex.Message; } catch (Exception ex) { srm.TipMsg = ex.Message; } } else { srm.TipMsg = "数据有效性验证失败!"; } return(Json(srm)); }
public ActionResult EditCurr(SystemAdminUpdate sau) { if (!Request.IsAjaxRequest()) { return(Content("操作失败,你的浏览器禁用了Javascript脚本!")); } ShowResultModel srm = new ShowResultModel(); if (ModelState.IsValid) { try { SystemAdmin sad = new SystemAdmin() { Email = sau.Email, SANickName = sau.SANickName, SAName = _curradmin.AdminInfo.SAName, SAPwd = "null", SASex = sau.SASex, SAMobileNo = sau.SAMobileNo, LoginTimes = 0, CurrentIP = "null", LastIP = "null", SAID = sau.SAID, IsEnable = false }; _sysadminService.EditCurr(sad); srm.TipMsg = "修改个人资料成功!"; srm.IsSuccess = true; } catch (InvalidOperationException ex) { srm.TipMsg = ex.Message; } catch (Exception ex) { srm.TipMsg = ex.Message; } } else { srm.TipMsg = "数据有效性验证失败!"; } return(Json(srm)); }
public ActionResult EditAction(AdminAction aat) { if (!Request.IsAjaxRequest()) { return(Content("操作失败,你的浏览器禁用了Javascript脚本!")); } ShowResultModel srm = new ShowResultModel(); if (ModelState.IsValid) { try { _adminActionService.EditAction(aat); srm.TipMsg = "修改操作权限成功!"; srm.IsSuccess = true; } catch (InvalidOperationException ex) { srm.TipMsg = ex.Message; } catch (Exception ex) { LoggerHelper.Log("【系统管理员操作权限修改】出错,系统操作管理员:" + _currentAdmin.AdminInfo.SAName + ",错误原因:" + (ex.InnerException == null ? ex.Message : ex.InnerException.ToString())); srm.TipMsg = ex.Message; } } else { srm.TipMsg = "数据有效性验证失败!"; } return(Json(srm)); }
public JsonResult Delete(int id) { ShowResultModel rs = new ShowResultModel(); AdminLog entity = _AdminLogService.GetByKey(id); if (entity == null) { rs.TipMsg = "未找到该记录!"; return(Json(rs, JsonRequestBehavior.AllowGet)); } try { _AdminLogService.Remove(entity); rs.TipMsg = "删除成功!"; rs.IsSuccess = true; } catch (Exception exc) { rs.TipMsg = exc.Message; LoggerHelper.Log("【删除系统管理员操作日志】出错,系统操作管理员:" + _currentAdmin.AdminInfo.SAName + ",错误原因:" + (exc.InnerException == null ? exc.Message : exc.InnerException.ToString())); } return(Json(rs, JsonRequestBehavior.AllowGet)); }
public ActionResult AddAction(AdminAction aat) { if (!Request.IsAjaxRequest()) { return(Content("操作失败,你的浏览器禁用了Javascript脚本!")); } ShowResultModel srm = new ShowResultModel(); if (ModelState.IsValid) { try { _adminActionService.AddAction(aat); srm.TipMsg = "新增操作权限块成功!<br/><br/><input type='button' class='box-buttonadd' value='继续添加' onclick='window.document.getElementById("lhgfrm_divaddAction").contentWindow.Goon();'/><input type='button' class='box-buttonclose' value='取消' onclick='window.document.getElementById("lhgfrm_divaddAction").contentWindow.Undo(" + aat.AMID + ");'/>"; srm.IsSuccess = true; } catch (InvalidOperationException ex) { srm.TipMsg = ex.Message; } catch (Exception ex) { srm.TipMsg = ex.Message; LoggerHelper.Log("【系统管理员操作权限添加】出错,系统操作管理员:" + _currentAdmin.AdminInfo.SAName + ",错误原因:" + (ex.InnerException == null ? ex.Message : ex.InnerException.ToString())); } } else { srm.TipMsg = "数据有效性验证失败!"; } return(Json(srm)); }
/// <summary> /// Her soru bitiminde tetiklenir. Günün birincisi sıralamasını ikinci ekranda yayınlar. /// </summary> /// <param name="model"></param> public void ShowResults(ShowResultModel model) { SetScreenType(); lwDaySummary.Items.Clear(); lwDaySummary.Font = new Font("Segoe UI", 50f, FontStyle.Bold); labelDaySummary.Text = "GÜNÜN BİRİNCİSİ SIRALAMASI"; labelDaySummary.Font = new Font("Segoe UI", 50f, FontStyle.Bold); var ix = 1; if (model.CurrentWinners != null) { foreach (var item in model.CurrentWinners.OrderByDescending(x => x.TotalScore)) { if (ix > 5) { break; } var lwItm = lwDaySummary.Items.Add(item.Sequence.ToString()); lwItm.Font = new Font("Segoe UI", 50f, FontStyle.Bold); lwItm.SubItems.Add(item.Sequence.ToString()); lwItm.SubItems.Add(item.DisplayName.ToUpper()); lwItm.SubItems.Add(item.TotalScore.ToString()); ix++; } } }
public ActionResult GetActions(int secondid, int arid) { ShowResultModel srm = new ShowResultModel(); try { //判断多选框选中还是没有 需要得到角色当前功能的权重值 wgt IEnumerable <AdminAction> listAA = _adminActionService.GetMany(new DirectSpecification <AdminAction>(aa => aa.AMID == secondid)); srm.TipMsg = _adminRoleService.GetActionCheck(listAA, arid); if (srm.TipMsg.Length == 0) { srm.TipMsg = "无数据"; } srm.IsSuccess = true; } catch (InvalidOperationException ex) { srm.TipMsg = ex.Message; } catch (Exception ex) { srm.TipMsg = ex.Message; LoggerHelper.Log("【获取action(角色)】出错,系统操作管理员:" + _currentAdmin.AdminInfo.SAName + ",错误原因:" + (ex.InnerException == null ? ex.Message : ex.InnerException.ToString())); } return(Json(srm, JsonRequestBehavior.AllowGet)); }
public ActionResult ChangePwd(ChangePassword cp) { if (!Request.IsAjaxRequest()) { return(Content("操作失败,你的浏览器禁用了Javascript脚本!")); } ShowResultModel srm = new ShowResultModel(); if (ModelState.IsValid) { try { SystemAdmin sys = _sysadminService.GetByCondition(new DirectSpecification <SystemAdmin>(sa => sa.SAID == cp.SAID)); _sysadminService.ChangePwd(sys, cp.Password, cp.OldPassword); srm.TipMsg = "修改密码成功!"; srm.IsSuccess = true; } catch (InvalidOperationException ex) { srm.TipMsg = ex.Message; } catch (Exception ex) { srm.TipMsg = ex.Message; } } else { srm.TipMsg = "数据有效性验证失败!"; } return(Json(srm)); }
public ActionResult Edit(AdminRole arl, string ModuleIds) { if (!Request.IsAjaxRequest()) { return(Content("操作失败,你的浏览器禁用了Javascript脚本!")); } var srm = new ShowResultModel(); if (ModelState.IsValid) { try { _adminRoleService.UpdateRole(arl, ModuleIds); srm.TipMsg = "修改角色成功!"; srm.IsSuccess = true; } catch (InvalidOperationException ex) { srm.TipMsg = ex.Message; } catch (Exception ex) { srm.TipMsg = ex.Message; LoggerHelper.Log("【修改管理员角色】出错,系统操作管理员:" + _currentAdmin.AdminInfo.SAName + ",错误原因:" + (ex.InnerException == null ? ex.Message : ex.InnerException.ToString())); } } else { srm.TipMsg = "数据有效性验证失败!"; } return(Json(srm)); }
public async Task <IActionResult> ShowResult(long id) { ShowResultModel model = await this.m_publishResultRepository.GetResultWithBenchmark(id); if (model == null) { return(NotFound()); } return(View(model)); }
public ActionResult Index(int?Fid) { if (Fid == null) { AddViewBagF(0); IEnumerable <AdminModule> listmodule = _adminModuleService.GetMany(new DirectSpecification <AdminModule>(am => am.FID == 0)).OrderBy(am => am.SortFlag); return(View(listmodule)); } else { var srm = new ShowResultModel(); srm.IsSuccess = true; srm.ReDirectUrl = "GetModuleList/" + Fid; return(Json(srm, JsonRequestBehavior.AllowGet)); } }
public async Task <IActionResult> Index(int id) { this.RemoveFrameOptionsHeader(); if (!this.m_resultsConfig.Value.BenchmarkEmbeddingEnabled) { return(View("Disabled", id)); } Preconditions.ToBeNonNegative(id); ShowResultModel model = await this.m_publishResultRepository.GetResultWithBenchmark(id); if (model == null) { return(PartialView("DoesNotExists", id)); } return(View(model)); }
public ActionResult ArticleDelete(int id) { ISpecification <BlogArticle> condition = new DirectSpecification <BlogArticle>(x => x.ArticleID == id); _articleService.Remove(condition); ShowResultModel ShowMsg = new ShowResultModel(); ShowMsg.PageTitle = string.Format("{0} 提示信息", "博文删除"); ShowMsg.ReDirectUrl = Url.Action("ArticleList"); ShowMsg.TipMsg = string.Format("博文ID为:{0} 删除成功", id); ShowMsg.Delay = 3000; ViewData["ShowMsg"] = ShowMsg; return(View("ShowResult")); }
public ActionResult CleareBeforeDate(DateTime dt) { ShowResultModel res = new ShowResultModel(); try { _AdminLogService.DeleteBeforeDate(dt); res.IsSuccess = true; res.TipMsg = "清除指定日期前的日志成功!";//ResultMsg.DelOK; } catch (Exception e) { res.TipMsg = e.Message; LoggerHelper.Log("【批量清除系统管理员日志】出错,系统操作管理员:" + _currentAdmin.AdminInfo.SAName + ",错误原因:" + (e.InnerException == null ? e.Message : e.InnerException.ToString())); } return(Json(res)); }
public ActionResult Delete(int id) { ISpecification <BlogCategory> condition = new DirectSpecification <BlogCategory>(x => x.CateID == id); _categoryService.Remove(condition); ShowResultModel ShowMsg = new ShowResultModel(); ShowMsg.PageTitle = string.Format("{0} 提示信息", "分类删除"); ShowMsg.ReDirectUrl = Url.Action("List"); ShowMsg.TipMsg = string.Format("分类ID为:{0} 删除成功", id); ShowMsg.Delay = 3000; ViewData["ShowMsg"] = ShowMsg; return(View("ShowResult")); }
public ActionResult Edit(SystemAdminUpdate sa, string CheckRoleIds, string oldPassword) { if (!Request.IsAjaxRequest()) { return(Content("操作失败,你的浏览器禁用了Javascript脚本!")); } ShowResultModel srm = new ShowResultModel(); if (ModelState.IsValid) { try { string pwd = string.Empty; if (oldPassword.Equals(sa.Password)) { pwd = sa.Password; } else { pwd = StrUtil.EncryptPassword(sa.Password, "MD5"); } SystemAdmin sad = new SystemAdmin() { Email = sa.Email, SANickName = sa.SANickName, SAName = sa.SAName, SAPwd = pwd, SASex = sa.SASex, SAMobileNo = sa.SAMobileNo, LoginTimes = 0, CurrentIP = "null", LastIP = "null", SAID = sa.SAID, IsEnable = sa.IsEnable }; _sysadminService.UpdateSysAdmin(sad, CheckRoleIds); srm.TipMsg = "修改管理员成功!"; srm.IsSuccess = true; } catch (InvalidOperationException ex) { srm.TipMsg = ex.Message; } catch (Exception ex) { srm.TipMsg = ex.Message; } } else { srm.TipMsg = "数据有效性验证失败!"; } return(Json(srm)); }
public ActionResult DeleteSome(string ids) { ShowResultModel res = new ShowResultModel(); try { string newids = ids.Substring(0, ids.Length - 1); string[] arrids = newids.Split('|'); _AdminLogService.DeleteSome(arrids); res.IsSuccess = true; res.TipMsg = "删除成功!"; } catch (Exception e) { res.TipMsg = e.Message; LoggerHelper.Log("【批量删除系统管理员日志】出错,系统操作管理员:" + _currentAdmin.AdminInfo.SAName + ",错误原因:" + (e.InnerException == null ? e.Message : e.InnerException.ToString())); } return(Json(res)); }
public ActionResult Save(BlogCategory model, FormCollection form) { int hID = Convert.ToInt32(form["hID"]); int CateID = Convert.ToInt32(form["CateID"]); bool IsEdit = hID > 0; ShowResultModel ShowMsg = new ShowResultModel(); if (IsEdit) { //编辑 model = _categoryService.GetByCondition(new DirectSpecification <BlogCategory>(x => x.CateID == hID)); model.CateName = RequestHelper.GetInputString(form["CateName"], "", true, true); model.ParentID = RequestHelper.GetInputInt32(form["CateID"], 0); model.State = RequestHelper.GetInputInt32(form["State"], 0); _categoryService.Modify(model); ShowMsg.PageTitle = string.Format("{0} 提示信息", "分类编辑"); ShowMsg.ReDirectUrl = Url.Action("List"); ShowMsg.TipMsg = string.Format("名称为:{0} 编辑成功", model.CateName); ShowMsg.Delay = 3000; } else { //新增 model.CreateTime = DateTime.Now; ShowMsg.PageTitle = string.Format("{0} 提示信息", "新增分类"); ShowMsg.ReDirectUrl = Url.Action("List"); ShowMsg.TipMsg = string.Format("名称为:{0} 新增成功", model.CateName); ShowMsg.Delay = 3000; _categoryService.NewSave(model); } ViewData["ShowMsg"] = ShowMsg; return(View("ShowResult")); }
public ActionResult Enable(string ids, bool isEnable) { ShowResultModel srm = new ShowResultModel(); try { _sysadminService.Enable(ids, isEnable); srm.IsSuccess = true; srm.TipMsg = "操作成功!"; srm.ReDirectUrl = "GetSysadminList"; } catch (InvalidOperationException ex) { srm.TipMsg = ex.Message; } catch (Exception e) { srm.TipMsg = e.Message; } return(Json(srm)); }
public ActionResult Delete(int id) { ShowResultModel srm = new ShowResultModel(); try { _sysadminService.DeleteSysAdmin(id); srm.IsSuccess = true; srm.TipMsg = "删除成功!"; srm.ReDirectUrl = "GetSysadminList"; } catch (InvalidOperationException ex) { srm.TipMsg = ex.Message; } catch (Exception ex) { srm.TipMsg = ex.Message; } return(Json(srm)); }
public ActionResult Setting(int arid, string CMIDWeight) { var srm = new ShowResultModel(); try { //计算/修改权值 _adminRoleService.UpdateWeight(arid, CMIDWeight); srm.TipMsg = "权限设置成功!"; srm.IsSuccess = true; } catch (InvalidOperationException ex) { srm.TipMsg = ex.Message; } catch (Exception ex) { srm.TipMsg = ex.Message; LoggerHelper.Log("【设置权值】出错,系统操作管理员:" + _currentAdmin.AdminInfo.SAName + ",错误原因:" + (ex.InnerException == null ? ex.Message : ex.InnerException.ToString())); } return(Json(srm)); }
public ActionResult Delete(int id) { ShowResultModel srm = new ShowResultModel(); try { _adminRoleService.DeleteRole(id); srm.IsSuccess = true; srm.TipMsg = "删除成功!"; srm.ReDirectUrl = "GetRoleList"; } catch (InvalidOperationException ex) { srm.TipMsg = ex.Message; } catch (Exception ex) { srm.TipMsg = ex.Message; LoggerHelper.Log("【管理员角色删除】出错,系统操作管理员:" + _currentAdmin.AdminInfo.SAName + ",错误原因:" + (ex.InnerException == null ? ex.Message : ex.InnerException.ToString())); } return(Json(srm)); }
public ActionResult Enable(string ids, bool isEnable, int fid) { ShowResultModel srm = new ShowResultModel(); try { _adminModuleService.Enable(ids, isEnable); srm.IsSuccess = true; srm.TipMsg = "操作成功!"; srm.ReDirectUrl = "GetModuleList/" + fid; } catch (InvalidOperationException ex) { srm.TipMsg = ex.Message; } catch (Exception e) { srm.TipMsg = e.Message; LoggerHelper.Log("【系统后台功能模块启用/禁用】出错,系统操作管理员:" + _currentAdmin.AdminInfo.SAName + ",错误原因:" + (e.InnerException == null ? e.Message : e.InnerException.ToString())); } return(Json(srm)); }
public ActionResult DeleteModuleList(string ids, int fid) { ShowResultModel res = new ShowResultModel(); try { _adminModuleService.DeleteList(ids); res.IsSuccess = true; res.TipMsg = "删除成功!"; res.ReDirectUrl = "GetModuleList/" + fid; } catch (InvalidOperationException ex) { res.TipMsg = ex.Message; } catch (Exception e) { res.TipMsg = e.Message; LoggerHelper.Log("【系统后台功能模块批量删除】出错,系统操作管理员:" + _currentAdmin.AdminInfo.SAName + ",错误原因:" + (e.InnerException == null ? e.Message : e.InnerException.ToString())); } return(Json(res)); }
public ActionResult DeleteActionList(string ids, int amid) { ShowResultModel res = new ShowResultModel(); try { _adminActionService.DeleteList(ids); res.IsSuccess = true; res.TipMsg = "删除成功!"; ViewBag.Amid = amid; res.ReDirectUrl = "/systemadmin/adminaction/GetActionList/" + amid; } catch (InvalidOperationException ex) { res.TipMsg = ex.Message; } catch (Exception e) { res.TipMsg = e.Message; LoggerHelper.Log("【系统管理员操作权限批量删除】出错,系统操作管理员:" + _currentAdmin.AdminInfo.SAName + ",错误原因:" + (e.InnerException == null ? e.Message : e.InnerException.ToString())); } return(Json(res)); }
public ActionResult GetSecondModule(int firstid, int arid) { ShowResultModel srm = new ShowResultModel(); try { srm.TipMsg = _adminRoleService.GetCurrRoleSecondModule(arid, firstid); if (srm.TipMsg.Length == 0) { srm.TipMsg = "无数据"; } srm.IsSuccess = true; } catch (InvalidOperationException ex) { srm.TipMsg = ex.Message; } catch (Exception ex) { srm.TipMsg = ex.Message; LoggerHelper.Log("【获取二级菜单(角色)】出错,系统操作管理员:" + _currentAdmin.AdminInfo.SAName + ",错误原因:" + (ex.InnerException == null ? ex.Message : ex.InnerException.ToString())); } return(Json(srm, JsonRequestBehavior.AllowGet)); }
//return Views public ActionResult MainAction(KetQuaModel model) { string path = HttpContext.Server.MapPath(""); string RePath = path.Replace("SQ", "Views\\SQ"); var answer = new UserAnswer(); answer.Object = "SQ_" + model.DeSo; string correctAns = CorrectAnswerHelper.GetCorrectAnswer(answer.Object); answer.UAnswer = model.TraLoi; answer.CorrectAnswer = correctAns; decimal mark = CorrectAnswerHelper.Calculate(answer, RePath); decimal k = Convert.ToDecimal(6.5); if (8 <= mark) { model.XepLoai = "G"; } else if (k <= mark) { model.XepLoai = "K"; } else if (5 <= mark) { model.XepLoai = "Đ"; } else { model.XepLoai = "KĐ"; } model.KQ = mark; model.DapAn = correctAns; //insert CorrectAnswerHelper.Insert(model); var show = new ShowResultModel(); show.mark = model.KQ; switch (model.XepLoai) { case "G": show.quality = "Giỏi"; break; case "K": show.quality = "Khá"; break; case "Đ": show.quality = "Đạt yêu cầu"; break; default: show.quality = "Không đạt yêu cầu"; break; } string desAction = model.IDQN + "_SQ_" + model.DeSo; show.fileName = desAction; show.type = "SQ"; var permission = new PermissionModel(); permission.SetLogStatus(model.IDQN, 2); return(RedirectToAction("Index", "Result", show)); }
public async Task <ShowResultModel> AddShow(ShowDomainModel requestedShow) { // check if requested show time is in the past if (requestedShow.ShowTime < DateTime.Now) { return(new ShowResultModel { isSuccessful = false, ErrorMessage = Messages.SHOW_IN_THE_PAST }); } // check if auditorium exist var existingAuditorium = await _auditoriumsRepository.GetByIdAsync(requestedShow.AuditoriumId); if (existingAuditorium == null) { return(new ShowResultModel { isSuccessful = false, ErrorMessage = Messages.CANNOT_CREATE_SHOW_AUDITORIUM_DOES_NOT_EXIST, }); } // check if piece exist var existingPiece = await _piecesRepository.GetByIdAsync(requestedShow.PieceId); if (existingPiece == null) { return(new ShowResultModel { isSuccessful = false, ErrorMessage = Messages.CANNOT_CREATE_SHOW_PIECE_DOES_NOT_EXIST }); } // check if shows are at the same time int showTime = 3; var allShows = await _showsRepository.GetAllAsync(); var allShowsInAuditorium = allShows .Where(show => show.AuditoriumId == requestedShow.AuditoriumId); var showsAtTheSameTime = allShowsInAuditorium .Where(x => x.ShowTime <requestedShow.ShowTime.AddHours(showTime) && x.ShowTime> requestedShow.ShowTime.AddHours(-showTime)); if (showsAtTheSameTime.Count() > 0) { return(new ShowResultModel { ErrorMessage = Messages.SHOWS_AT_THE_SAME_TIME, isSuccessful = false }); } // check if actors are provided if (requestedShow.ActorsList.Count() == 0) { return(new ShowResultModel { ErrorMessage = Messages.ACTORS_NOT_PROVIDED, isSuccessful = false }); } // check if actors exist in database var allActors = await _actorsRepository.GetAllAsync(); IEnumerable <int> actorIds = allActors.Select(actor => actor.Id); IEnumerable <int> requestedActorIds = requestedShow.ActorsList.Select(actor => actor.Id); var actorsInBoth = actorIds.Intersect(requestedActorIds); if (actorsInBoth.Count() < requestedActorIds.Count()) { return(new ShowResultModel { isSuccessful = false, ErrorMessage = Messages.CANNOT_CREATE_SHOW_ACTORS_DOES_NOT_EXIST }); } //check if any actor has more than 2 shows on the same day var requestedActorsInDatabase = new List <Actor>(); foreach (var requested in requestedShow.ActorsList) { var actor = await _actorsRepository.GetByIdAsync(requested.Id); requestedActorsInDatabase.Add(actor); } foreach (var actor in requestedActorsInDatabase) { if (actor.ShowActors.Any(showactor => showactor.Show.ShowTime.Date == requestedShow.ShowTime.Date)) { if (actor.ShowActors.Count(showActor => showActor.Show.ShowTime.Date == requestedShow.ShowTime.Date) > 2) { return(new ShowResultModel { ErrorMessage = Messages .CANNOT_CREATE_SHOW_SOME_ACTORS_HAVE_MORE_THAN_TWO_SHOWS_PER_DAY, isSuccessful = false, }); } } } // insert in database Show showToInsert = new Show { ShowTime = requestedShow.ShowTime, AuditoriumId = requestedShow.AuditoriumId, PieceId = requestedShow.PieceId, TicketPrice = requestedShow.TicketPrice }; var insertedShow = _showsRepository.Insert(showToInsert); insertedShow.ShowActors = requestedShow.ActorsList.Select(actorDomainModel => new ShowActor { ActorId = actorDomainModel.Id, ShowId = insertedShow.Id }).ToList(); _showsRepository.Save(); // return created show to user var createdShow = await _showsRepository.GetByIdAsync(insertedShow.Id); ShowResultModel resultModel = new ShowResultModel { ErrorMessage = null, isSuccessful = true, ShowDomainModel = new ShowDomainModel { Id = createdShow.Id, AuditoriumId = createdShow.AuditoriumId, PieceId = createdShow.PieceId, TicketPrice = createdShow.TicketPrice, ShowTime = createdShow.ShowTime, PieceTitle = createdShow.Piece.Title, ActorsList = createdShow.ShowActors.Select(showActor => new ActorDomainModel { Id = showActor.Actor.Id, FirstName = showActor.Actor.FirstName, LastName = showActor.Actor.LastName }).ToList() } }; return(resultModel); }
public ActionResult ArticleSave(BlogArticle model, FormCollection form) { int hID = Convert.ToInt32(form["hID"]); int CateID = Convert.ToInt32(form["CateID"]); bool DownMeta = Convert.ToBoolean(form["DownMeta"]); bool AutoMark = Convert.ToBoolean(form["AutoMark"]); bool TopAsThumbnail = Convert.ToBoolean(form["TopAsThumbnail"]); bool IsEdit = hID > 0; if (IsEdit) { //编辑 model = _articleService.GetByCondition(new DirectSpecification <BlogArticle>(x => x.ArticleID == hID)); model.BlogCategory = _categoryService.GetByCondition(new DirectSpecification <BlogCategory>(x => x.CateID == CateID)); } model.ImageUrl = RequestHelper.GetInputString(form["hImageUrl"], "", true, true); ShowResultModel ShowMsg = new ShowResultModel(); model.Content = RequestHelper.GetInputString(form["Content"], "", false, false); //下载远程图片 if (DownMeta) { ContentData cdata = SaveRemoteFileHelper.SavePic(model.Content, AutoMark); model.Content = cdata.Content; if (cdata.FileList.Count > 0 && TopAsThumbnail) { model.ImageUrl = cdata.FileList[0]; } } if (IsEdit) { //编辑 model.Title = RequestHelper.GetInputString(form["Title"], "", true, true); model.IsTop = RequestHelper.GetInputBoolean(form["IsTop"].Split(',')[0], false); model.Tag = RequestHelper.GetInputString(form["Tag"], "", true, true); model.Description = RequestHelper.GetInputString(form["Description"], "", true, true); model.State = RequestHelper.GetInputInt32(form["State"], 0); model.PublishTime = RequestHelper.GetInputDateTime(form["PublishTime"], DateTime.Now); model.Hits = RequestHelper.GetInputInt32(form["Hits"], 0); _articleService.Modify(model); ShowMsg.PageTitle = string.Format("{0} 提示信息", "博文编辑"); ShowMsg.ReDirectUrl = Url.Action("ArticleList"); ShowMsg.TipMsg = string.Format("标题为:{0} 编辑成功", model.Title); ShowMsg.Delay = 3000; } else { //新增 model.BlogCategory = _categoryService.GetByCondition(new DirectSpecification <BlogCategory>(x => x.CateID == CateID)); model.CreateTime = DateTime.Now; model.UpdateTime = DateTime.Now; model.UserID = 0; model.UserName = ""; model.UserIP = RequestHelper.GetIP(); ShowMsg.PageTitle = string.Format("{0} 提示信息", "博文发布"); ShowMsg.ReDirectUrl = Url.Action("ArticleList"); ShowMsg.TipMsg = string.Format("标题为:{0} 发布成功", model.Title); ShowMsg.Delay = 3000; _articleService.NewSave(model); } ViewData["ShowMsg"] = ShowMsg; return(View("ShowResult")); }
// GET: Result public ActionResult Index(ShowResultModel model) { string ViewName = model.type + "/" + model.fileName; return(View(ViewName, model)); }