public ActionResult NewWarehouse() { //创建空的Model WarehouseViewModel model = new WarehouseViewModel(); return View(model); }
public ActionResult NewWarehouse(WarehouseViewModel model) { if (ModelState.IsValid) { //创建数据 Warehouse data = new Warehouse(); data.Name = model.Name; data.IsLease = model.IsLease; data.Remark = model.Remark; //保存数据 string strErrText; DDSystem dd = new DDSystem(); if (dd.InsertWarehouse(data, LoginAccountId, LoginStaffName, out strErrText)) { return Json(string.Empty); } else { return Json(strErrText); } } return View(model); }
public ActionResult ModifyWarehouse(string id) { string strErrText; //生成Model数据 DDSystem dd = new DDSystem(); Warehouse data = dd.LoadWarehouse(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText); if (data == null) { throw new Exception(strErrText); } WarehouseViewModel model = new WarehouseViewModel(); model.Id = data.Id; model.Name = data.Name; model.IsLease = data.IsLease; model.Remark = data.Remark; return View(model); }