示例#1
0
        public ActionResult RoomEdit(int id, int? building, FormCollection collection)
        {
            if (!UserInfo.CurUser.HasRight("租赁管理-项目维护")) return Redirect("~/content/AccessDeny.htm");
            Room s = null;
            if (id != 0)
            {
                s = db.Rooms.Find(id);
            }
            if (s == null)
            {
                s = new Room();
                s.BuildingId = (int)building;
                db.Rooms.Add(s);
            }
            //collection.Remove("");
            TryUpdateModel(s, "", new string[] { }, new string[] { "" }, collection);

            if (ModelState.IsValid)
            {

                db.SaveChanges();
                if (id == 0)
                {
                    BLL.Utilities.AddLogAndSave(s.Id, Room.LogClass, "创建", "");

                }
                else
                {
                    BLL.Utilities.AddLogAndSave(s.Id, Room.LogClass, "修改", "");
                }
                return Redirect(string.Format("../RoomView/{0}?reload=1" , s.Id));
            }

            return View(s);
        }
示例#2
0
 public ActionResult RoomEdit(int id, int? building)
 {
     if (!UserInfo.CurUser.HasRight("租赁管理-项目维护")) return Redirect("~/content/AccessDeny.htm");
     Room s = null;
     if(id!=0)
     {s=db.Rooms.Find(id);
     }
     if (s == null)
     {
         s = new Room();
         s.BuildingId = (int) building;
     }
     return View(s);
 }