Esempio n. 1
0
 public void Add(MobilGame model)
 {
     _dao.Add(model);
 }
Esempio n. 2
0
 public void Update(MobilGame model)
 {
     _dao.Update(model);
 }
Esempio n. 3
0
        public ActionResult Save(SaveMobilGame savemodel)
        {
            ViewData["syslist"] = GameSysEnum.Andior.ToSelectListAddDefault();
            if (ModelState.IsValid)
            {
                string errMsg, savePath = string.Empty;
                if (savemodel.ID == null)
                {
                    if (Request.Files.Count != 0 && Request.Files[0].ContentLength != 0)
                    {
                        if (!UploadService.UploadFile(Request.Files[0], out savePath, out errMsg))
                        {
                            return(AlertMsg(errMsg, Request.UrlReferrer.PathAndQuery));
                        }
                    }

                    var model = new MobilGame
                    {
                        GameName       = savemodel.GameName,
                        ImgPath        = savePath,
                        Sys            = savemodel.Sys,
                        Size           = savemodel.Size,
                        HasGift        = savemodel.HasGift,
                        IsHot          = savemodel.IsHot,
                        IsNew          = savemodel.IsNew,
                        IsBiWan        = savemodel.IsBiWan,
                        IsThisAWeekHot = savemodel.IsThisAWeekHot,
                        IsTuiJian      = savemodel.IsTuiJian,
                        GameType       = savemodel.GameType,
                        GameTeZhen     = savemodel.GameTeZhen,
                        YunYingState   = savemodel.YunYingState,
                        HotScore       = savemodel.HotScore,
                        CreateDate     = DateTime.Now,
                        IsGameType     = savemodel.IsGameType,
                        IsQianLiBao    = savemodel.IsQianLiBao,
                        Sort           = savemodel.Sort,
                        Domain         = savemodel.Domain,
                        GameDes        = savemodel.GameDes,
                    };
                    _mobilgameTask.Add(model);
                }
                else
                {
                    var model = _mobilgameTask.GetById((int)savemodel.ID);

                    if (Request.Files.Count != 0 && Request.Files[0].ContentLength != 0)
                    {
                        if (!UploadService.UploadFile(Request.Files[0], out savePath, out errMsg))
                        {
                            return(AlertMsg(errMsg, Request.UrlReferrer.PathAndQuery));
                        }

                        model.ImgPath = savePath;
                    }


                    if (model == null)
                    {
                        return(AlertMsg("参数错误", HttpContext.Request.UrlReferrer.PathAndQuery));
                    }

                    model.GameName = savemodel.GameName;

                    model.Sys            = savemodel.Sys;
                    model.Size           = savemodel.Size;
                    model.HasGift        = savemodel.HasGift;
                    model.IsHot          = savemodel.IsHot;
                    model.IsNew          = savemodel.IsNew;
                    model.IsBiWan        = savemodel.IsBiWan;
                    model.IsThisAWeekHot = savemodel.IsThisAWeekHot;
                    model.IsTuiJian      = savemodel.IsTuiJian;
                    model.GameType       = savemodel.GameType;
                    model.GameTeZhen     = savemodel.GameTeZhen;
                    model.YunYingState   = savemodel.YunYingState;
                    model.HotScore       = savemodel.HotScore;
                    model.IsGameType     = savemodel.IsGameType;
                    model.IsQianLiBao    = savemodel.IsQianLiBao;
                    model.Sort           = savemodel.Sort;
                    model.Domain         = savemodel.Domain;
                    model.GameDes        = savemodel.GameDes;
                    _mobilgameTask.Update(model);
                }
                return(AlertMsg("保存成功", HttpContext.Request.UrlReferrer.PathAndQuery));
            }
            return(View(savemodel));
        }