/// <summary> /// 设置model,如果不为空就设置,如果为空则和之前一样 /// </summary> /// <param name="target"></param> /// <param name="source"></param> /// <returns></returns> public JMSJieDianClassModel SetJMSJieDianClassModel(JMSJieDianClassModel model, JMSJieDianClassModelReq data) { if (!string.IsNullOrEmpty(data.JdClassName)) { model.JdClassName = data.JdClassName; } if (data.JdClassPaiXu != null) { model.JdClassPaiXu = data.JdClassPaiXu.Value; } if (data.JdClassStateID != null) { model.JdClassStateID = data.JdClassStateID.Value; } if (!string.IsNullOrEmpty(data.optName)) { model.optName = data.optName; } if (data.optDateTime != null && data.optDateTime != DateTime.MinValue && data.optDateTime != SqlDateTime.MinValue.Value) { model.optDateTime = data.optDateTime.Value; } return(model); }
public JMSJieDianClassModel UpdateSingle(int id, JMSJieDianClassModelReq data) { JMSJieDianClassModel model = db.JMSJieDianClassModel.Find(id); SetJMSJieDianClassModel(model, data); db.SaveChanges(); return(model); }
public static JMSJieDianClassObj TranferModelToObj(JMSJieDianClassModel model, int jmsId, string jmsName, int projectId) { JMSJieDianClassObj obj = new JMSJieDianClassObj(); obj.JdClassModelName = model.JdClassName; obj.JdClassModelID = model.id; obj.JdClassPaiXu = model.JdClassPaiXu; obj.JmsID = jmsId; obj.JmsName = jmsName; obj.ProjectID = projectId; return(obj); }