예제 #1
0
        /// <summary>
        /// 获得一条数据
        /// </summary>
        /// <returns></returns>
        public async Task <ApiResult <ErpTransferGoods> > GetByGuidAsync(string parm)
        {
            var model = ErpTransferGoodsDb.GetById(parm);
            var res   = new ApiResult <ErpTransferGoods>
            {
                statusCode = 200,
                data       = model ?? new ErpTransferGoods()
                {
                }
            };

            return(await Task.Run(() => res));
        }
예제 #2
0
        /// <summary>
        /// 修改一条数据
        /// </summary>
        /// <returns></returns>
        public async Task <ApiResult <string> > ModifyAsync(ErpTransferGoods parm)
        {
            var res = new ApiResult <string>()
            {
                data = "1", statusCode = 200
            };

            try
            {
                var dbres = ErpTransferGoodsDb.Update(parm);
                if (!dbres)
                {
                    res.statusCode = (int)ApiEnum.Error;
                    res.message    = "修改数据失败~";
                }
            }
            catch (Exception ex)
            {
                res.statusCode = (int)ApiEnum.Error;
                res.message    = ApiEnum.Error.GetEnumText() + ex.Message;
            }
            return(await Task.Run(() => res));
        }
예제 #3
0
        /// <summary>
        /// 删除一条或多条数据
        /// </summary>
        /// <returns></returns>
        public async Task <ApiResult <string> > DeleteAsync(string parm)
        {
            var res = new ApiResult <string>()
            {
                data = "1", statusCode = 200
            };

            try
            {
                var list  = Utils.StrToListString(parm);
                var dbres = ErpTransferGoodsDb.Delete(m => list.Contains(m.Guid));
                if (!dbres)
                {
                    res.statusCode = (int)ApiEnum.Error;
                    res.message    = "删除数据失败~";
                }
            }
            catch (Exception ex)
            {
                res.statusCode = (int)ApiEnum.Error;
                res.message    = ApiEnum.Error.GetEnumText() + ex.Message;
            }
            return(await Task.Run(() => res));
        }