Esempio n. 1
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Edit(V_xy_sp_spiritskill model)
        {
            if (model == null)
            {
                return(false);
            }
            using (xy_sp_spiritskillDAL dal = new xy_sp_spiritskillDAL()){
                xy_sp_spiritskill entitys = ModelToEntity(model);

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

            using (xy_sp_spiritskillDAL dal = new xy_sp_spiritskillDAL()){
                xy_sp_spiritskill entity = ModelToEntity(model);
                entity.SpiritSkillID = string.IsNullOrEmpty(model.SpiritSkillID) ? Guid.NewGuid().ToString("N") : model.SpiritSkillID;

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

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

            return(Ok("ok"));
        }
Esempio n. 4
0
        /// <summary>
        /// Model转Entity
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        private xy_sp_spiritskill ModelToEntity(V_xy_sp_spiritskill model)
        {
            if (model != null)
            {
                xy_sp_spiritskill entity = new xy_sp_spiritskill()
                {
                    SpiritSkillID = model.SpiritSkillID,
                    SpiritID      = model.SpiritID,
                    SkillID       = model.SkillID,
                    IsReady       = model.IsReady,
                };

                return(entity);
            }
            return(null);
        }
Esempio n. 5
0
        /// <summary>
        /// Entity转Model
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        private V_xy_sp_spiritskill  EntityToModel(xy_sp_spiritskill entity)
        {
            if (entity != null)
            {
                xy_sp_skillBLL      bll   = new xy_sp_skillBLL();
                V_xy_sp_spiritskill model = new V_xy_sp_spiritskill()
                {
                    SpiritSkillID = entity.SpiritSkillID,
                    SpiritID      = entity.SpiritID,
                    SkillID       = entity.SkillID,
                    IsReady       = entity.IsReady,
                    skill         = bll.Get(c => c.SkillID == entity.SkillID)
                };

                return(model);
            }

            return(null);
        }
Esempio n. 6
0
        public IHttpActionResult Get(string ID)
        {
            V_xy_sp_spiritskill model = bll.Get(p => p.SpiritSkillID == ID);

            return(Ok(model));
        }