Exemplo n.º 1
0
        public ActionResult LineEdit(string id)
        {
            var bll   = new MatchBll();
            var model = bll.GetLineById(id);
            List <SelectListItem> Status = new MemberBll().GetDict(3);

            foreach (SelectListItem r in Status)
            {
                if (model.Status.ToString() == r.Value)
                {
                    ViewBag.Status += "<option value='" + r.Value.ToString() + "'selected>" + r.Text.ToString() + "</option>";
                }
                else
                {
                    ViewBag.Status += "<option value='" + r.Value.ToString() + "'>" + r.Text.ToString() + "</option>";
                }
            }

            return(View(model));
        }
Exemplo n.º 2
0
        public ActionResult LineEdit(string id, FormCollection fc)
        {
            var bll   = new MatchBll();
            var model = bll.GetLineById(id);

            model.Name       = fc["Name"].ToString().Trim();
            model.Content    = fc["Content"].ToString().Trim();
            model.Players    = Int32.Parse(fc["Players"].ToString().Trim());
            model.Count      = Int32.Parse(fc["Count"].ToString().Trim());
            model.Conditions = "{players:\"" + model.Players.ToString() + "\",count:\"" + model.Count.ToString() + "\"}";
            model.Status     = Int32.Parse(fc["optStatus"].ToString());
            try
            {
                bll.EditLine(model);
            }
            catch (ValidException ex)
            {
                this.ModelState.AddModelError(ex.Name, ex.Message);
                return(View(model));
            }

            return(this.RefreshParent());
        }