Esempio n. 1
0
        public CanOtherInfo UpdateSingle(int id, CanOtherInfoReq data)
        {
            CanOtherInfo model = db.CanOtherInfo.Find(id);

            SetCanOtherInfo(model, data);
            db.SaveChanges();
            return(model);
        }
Esempio n. 2
0
        /// <summary>
        /// 设置model,如果不为空就设置,如果为空则和之前一样
        /// </summary>
        /// <param name="target"></param>
        /// <param name="source"></param>
        /// <returns></returns>
        public CanOtherInfo SetCanOtherInfo(CanOtherInfo model, CanOtherInfoReq data)
        {
            if (data.ServerDate != null && data.ServerDate != DateTime.MinValue && data.ServerDate != SqlDateTime.MinValue.Value)
            {
                model.ServerDate = data.ServerDate.Value;
            }
            if (data.JiaWuCanCount != null)
            {
                model.JiaWuCanCount = data.JiaWuCanCount.Value;
            }
            if (data.JiaWanCanCount != null)
            {
                model.JiaWanCanCount = data.JiaWanCanCount.Value;
            }
            if (data.YuanWuCanCount != null)
            {
                model.YuanWuCanCount = data.YuanWuCanCount.Value;
            }
            if (data.YuanWanCanCount != null)
            {
                model.YuanWanCanCount = data.YuanWanCanCount.Value;
            }
            if (data.projectid != null)
            {
                model.projectid = data.projectid.Value;
            }
            if (!string.IsNullOrEmpty(data.ProjectName))
            {
                model.ProjectName = data.ProjectName;
            }
            if (data.Createdate != null && data.Createdate != DateTime.MinValue && data.Createdate != SqlDateTime.MinValue.Value)
            {
                model.Createdate = data.Createdate.Value;
            }
            if (data.optid != null)
            {
                model.optid = data.optid.Value;
            }
            if (!string.IsNullOrEmpty(data.optName))
            {
                model.optName = data.optName;
            }
            if (!string.IsNullOrEmpty(data.State))
            {
                model.State = data.State;
            }

            return(model);
        }