Пример #1
0
        /// <summary>
        /// 设置model,如果不为空就设置,如果为空则和之前一样
        /// </summary>
        /// <param name="target"></param>
        /// <param name="source"></param>
        /// <returns></returns>
        public HuoPingBuMenKuCun SetHuoPingBuMenKuCun(HuoPingBuMenKuCun model, HuoPingBuMenKuCunReq data)
        {
            if (data.projectId != null)
            {
                model.projectId = data.projectId.Value;
            }
            if (!string.IsNullOrEmpty(data.projectName))
            {
                model.projectName = data.projectName;
            }
            if (data.HPId != null)
            {
                model.HPId = data.HPId.Value;
            }
            if (!string.IsNullOrEmpty(data.HPName))
            {
                model.HPName = data.HPName;
            }
            if (data.CurStock != null)
            {
                model.CurStock = data.CurStock.Value;
            }

            return(model);
        }
Пример #2
0
        public HuoPingBuMenKuCun UpdateSingle(int id, HuoPingBuMenKuCunReq data)
        {
            HuoPingBuMenKuCun model = db.HuoPingBuMenKuCun.Find(id);

            SetHuoPingBuMenKuCun(model, data);
            db.SaveChanges();
            return(model);
        }