public ActionResult Index2(long roomRegId, long itemId = 0) { if (itemId == 0) { return(View(new RoomRegSk() { HotelId = UserContext.CurrentUser.HotelId, RoomRegId = roomRegId, FsTime = DateTime.Now.ToString("yyyy-MM-dd HH:ss") })); } else { var model = RoomRegSkBll.GetById(itemId); if (model == null) { model = new RoomRegSk() { HotelId = UserContext.CurrentUser.HotelId, RoomRegId = roomRegId, FsTime = DateTime.Now.ToString("yyyy-MM-dd HH:ss") }; } return(View(model)); } }
public ActionResult _Cffy(long id) { var model = RoomRegSkBll.GetById(id); if (model == null) { model = new RoomRegSk() { Id = 0 } } ; //数据不存在 return(View(model)); }
public JsonResult AddOrUpdate(RoomRegSk model) { var apiResult = new APIResult(); var user = UserContext.CurrentUser; try { RoomRegSkBll.AddOrUpdate(model, user.Id, user.Name, user.HotelId); } catch (Exception ex) { apiResult.Ret = -1; apiResult.Msg = ex.Message; if (!(ex is OperationExceptionFacade)) { LogFactory.GetLogger().Log(LogLevel.Error, ex); } } return(Json(apiResult)); }