Esempio n. 1
0
 public ActionResult UpdateTeam(BasketballTeam team, HttpPostedFileBase TeamImage, bool isAdd)
 {
     team.WebName = string.IsNullOrEmpty(team.WebName)?null:team.WebName.Replace("\r\n", ",");
     int n = _IBasketballTeamService.UpdateTeam(team, isAdd);
     if (TeamImage != null)
     {
         int id = team.TeamID;
         AppData.UpLoadImage(Server.MapPath(AppData.GetImagePath(team.GameType)), TeamImage.InputStream, Server.MapPath(AppData.GetTeamImagePath(team.GameType, id)));
         //添加随机数 刷新图片
         return Json(new { count = n, path = string.Format("{0}?{1}", AppData.GetTeamImagePath(team.GameType, id), DateTime.Now.Ticks) });
     }
     else
     {
         return Json(new { count = n });
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 队伍新增、修改
 /// </summary>
 /// <param name="gameType"></param>
 /// <param name="teamid"></param>
 /// <returns></returns>
 public ActionResult UpdateTeam(string gameType, int? teamid)
 {
     BasketballTeam team = new BasketballTeam();
     string imagePath = string.Empty;
     if (teamid != null)
     {
         team = _IBasketballTeamService.QueryById(teamid.Value);
         imagePath = AppData.GetTeamImagePath(gameType, teamid.Value);
         imagePath = System.IO.File.Exists(Server.MapPath(imagePath)) ? imagePath : string.Empty;
     }
     List<BasketballAlliance> alliances = _IBasketballAllianceService.QueryByCondition(p => p.GameType == gameType).ToList();
     ViewBag.alliance = alliances.Select(p => new SelectListItem { Text = p.AllianceName, Value = p.AllianceID.ToString(), Selected = teamid == null ? false : p.AllianceID == team.AllianceID });
     List<SourceType> source = _ISourceTypeService.GetAllSourceType(gameType);
     ViewBag.SourceType = source.Select(p => new SelectListItem { Text = p.GameSource, Value = p.SourceID.ToString(), Selected = teamid == null ? false : p.SourceID == team.SourceID });
     ViewBag.ExistImage = imagePath;
     ViewBag.IsAdd = teamid == null;
     ViewBag.gameType = gameType;
     ViewBag.navigation = new Navigation
     {
         Level = new List<string> { AppData.GetGameTypeName(gameType), "隊伍修改" },
         Area = RouteData.DataTokens["area"].ToString(),
         Controller = RouteData.Values["controller"].ToString(),
         Action = "BasketBallTeam",
         HaveButton = true,
         ButtonText = "回隊伍管理",
         Parameter = new List<Parameter>{
             new Parameter("gameType", gameType)
         }
     };
     return View(team);
 }