Beispiel #1
0
 /// <summary>
 /// 获取单条数据
 /// </summary>
 /// <returns></returns>
 public V_xy_sp_outfit Get(Expression <Func <xy_sp_outfit, bool> > predicate = null)
 {
     using (xy_sp_outfitDAL dal = new xy_sp_outfitDAL()){
         xy_sp_outfit entity = dal.Get(predicate);
         return(EntityToModel(entity));
     }
 }
Beispiel #2
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Edit(V_xy_sp_outfit model)
        {
            if (model == null)
            {
                return(false);
            }
            using (xy_sp_outfitDAL dal = new xy_sp_outfitDAL()){
                xy_sp_outfit entitys = ModelToEntity(model);

                return(dal.Edit(entitys));
            }
        }
Beispiel #3
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public string Add(V_xy_sp_outfit model)
        {
            if (model == null)
            {
                return(string.Empty);
            }

            using (xy_sp_outfitDAL dal = new xy_sp_outfitDAL()){
                xy_sp_outfit entity = ModelToEntity(model);
                entity.OutfitID = string.IsNullOrEmpty(model.OutfitID) ? Guid.NewGuid().ToString("N") : model.OutfitID;

                return(dal.Add(entity));
            }
        }
Beispiel #4
0
        /// <summary>
        /// Model转Entity
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        private xy_sp_outfit ModelToEntity(V_xy_sp_outfit model)
        {
            if (model != null)
            {
                xy_sp_outfit entity = new xy_sp_outfit()
                {
                    OutfitID      = model.OutfitID,
                    EquipmentName = model.EquipmentName,
                    NeedLevel     = model.NeedLevel,
                    Price         = model.Price,
                };

                return(entity);
            }
            return(null);
        }
Beispiel #5
0
        /// <summary>
        /// Entity转Model
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        private V_xy_sp_outfit  EntityToModel(xy_sp_outfit entity)
        {
            if (entity != null)
            {
                V_xy_sp_outfit model = new V_xy_sp_outfit()
                {
                    OutfitID      = entity.OutfitID,
                    EquipmentName = entity.EquipmentName,
                    NeedLevel     = entity.NeedLevel,
                    Price         = entity.Price,
                };

                return(model);
            }

            return(null);
        }