Пример #1
0
        public JMSGengZong UpdateSingle(int id, JMSGengZongReq data)
        {
            JMSGengZong model = db.JMSGengZong.Find(id);

            SetJMSGengZong(model, data);
            db.SaveChanges();
            return(model);
        }
Пример #2
0
        /// <summary>
        /// 设置model,如果不为空就设置,如果为空则和之前一样
        /// </summary>
        /// <returns></returns>
        public JMSGengZong SetJMSGengZong(JMSGengZong model, JMSGengZongReq data)
        {
            if (!string.IsNullOrEmpty(data.JmsName))
            {
                model.JmsName = data.JmsName;
            }
            if (!string.IsNullOrEmpty(data.LxrName))
            {
                model.LxrName = data.LxrName;
            }
            if (!string.IsNullOrEmpty(data.GenzongInfo))
            {
                model.GenzongInfo = data.GenzongInfo;
            }
            if (data.GengzongDateTime != DateTime.MinValue && data.GengzongDateTime != SqlDateTime.MinValue.Value)
            {
                model.GengzongDateTime = data.GengzongDateTime;
            }
            if (!string.IsNullOrEmpty(data.optName))
            {
                model.optName = data.optName;
            }
            if (data.GenzongStateID != null)
            {
                model.GenzongStateID = data.GenzongStateID.Value;
            }
            if (data.JmsID != null)
            {
                model.JmsID = data.JmsID.Value;
            }
            if (data.LxrID != null)
            {
                model.LxrID = data.LxrID.Value;
            }
            if (data.optDateTime != null && data.optDateTime != DateTime.MinValue && data.optDateTime != SqlDateTime.MinValue.Value)
            {
                model.optDateTime = data.optDateTime.Value;
            }

            return(model);
        }