示例#1
0
        public ActionResult Edit(House house)
        {
            if (ModelState.IsValid)
            {
                int  id      = house.HouseId ?? -1;
                bool ret     = false;
                var  manager = new HouseManager();
                if (id > 0)
                {
                    ret = manager.Update(house);
                }
                else
                {
                    house.PublishUserId = (Session["admin"] as User).LoginId;
                    ret = manager.Add(house);
                }
                string msg = ret ? "编辑成功!" : "编辑失败!";
                return(Content("<script>alert('" + msg + "');location.href='/Admin?userId=" + (Session["admin"] as User).LoginId + "';</script>"));
            }

            return(View(house));
        }