// // GET: /PropertySub/ public ActionResult savePropertyTake() { string account = System.Web.HttpContext.Current.Session["account"].ToString(); property_take pt = new property_take(); pt.ID = Guid.NewGuid().ToString(); pt.propertyName = Request["propertyName"] == null ? "" : Request["propertyName"].ToString(); pt.qty = int.Parse(Request["qty"] == null ? "0" : Request["qty"].ToString()); pt.status = 0; pt.takeTime = DateTime.Now; pt.takeUnit = Request["takeUnit"] == null ? "" : Request["takeUnit"].ToString(); pt.type = int.Parse(Request["type"] == null ? "" : Request["type"].ToString()); pt.account = account; MsgBox mb = new PropertyTakeManager().saveTake(pt); return(Json(mb)); }
public MsgBox saveTake(property_take pt) { MsgBox mb = new MsgBox(); if (string.IsNullOrEmpty(pt.ID)) { pt.ID = Guid.NewGuid().ToString(); } try { new Repository <property_take>().Insert(pt); mb.status = true; mb.msg = "保存成功。"; } catch (Exception e) { mb.status = false; mb.msg = e.Message; } return(mb); }