Example #1
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Edit(V_xy_sp_outfitequipment model)
        {
            if (model == null)
            {
                return(false);
            }
            using (xy_sp_outfitequipmentDAL dal = new xy_sp_outfitequipmentDAL()){
                xy_sp_outfitequipment entitys = ModelToEntity(model);

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

            using (xy_sp_outfitequipmentDAL dal = new xy_sp_outfitequipmentDAL()){
                xy_sp_outfitequipment entity = ModelToEntity(model);
                entity.OutfitEquipmentID = string.IsNullOrEmpty(model.OutfitEquipmentID) ? Guid.NewGuid().ToString("N") : model.OutfitEquipmentID;

                return(dal.Add(entity));
            }
        }
        public IHttpActionResult Post([FromBody] Request <V_xy_sp_outfitequipment> request)
        {
            V_xy_sp_outfitequipment model = request.Data as V_xy_sp_outfitequipment;

            if (string.IsNullOrEmpty(model.OutfitEquipmentID))
            {
                bll.Add(model);
            }
            else
            {
                bll.Edit(model);
            }

            return(Ok("ok"));
        }
Example #4
0
        /// <summary>
        /// Model转Entity
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        private xy_sp_outfitequipment ModelToEntity(V_xy_sp_outfitequipment model)
        {
            if (model != null)
            {
                xy_sp_outfitequipment entity = new xy_sp_outfitequipment()
                {
                    OutfitEquipmentID = model.OutfitEquipmentID,
                    OutfitID          = model.OutfitID,
                    EquipmentID       = model.EquipmentID,
                    EquipmentType     = model.EquipmentType,
                    gainType          = model.gainType,
                    gainValue         = model.gainValue,
                };

                return(entity);
            }
            return(null);
        }
Example #5
0
        /// <summary>
        /// Entity转Model
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        private V_xy_sp_outfitequipment  EntityToModel(xy_sp_outfitequipment entity)
        {
            if (entity != null)
            {
                V_xy_sp_outfitequipment model = new V_xy_sp_outfitequipment()
                {
                    OutfitEquipmentID = entity.OutfitEquipmentID,
                    OutfitID          = entity.OutfitID,
                    EquipmentID       = entity.EquipmentID,
                    EquipmentType     = entity.EquipmentType,
                    gainType          = entity.gainType,
                    gainValue         = entity.gainValue,
                };

                return(model);
            }

            return(null);
        }
        public IHttpActionResult Get(string ID)
        {
            V_xy_sp_outfitequipment model = bll.Get(p => p.OutfitEquipmentID == ID);

            return(Ok(model));
        }