API-DAL后台示例--dal(添加,显示)

dal(添加,显示)
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Model;
namespace DAL
{
    public class ShoppingDAL
    {
        DBHelper helper = new DBHelper();
        /// <summary>
        /// 新增优惠券的方式
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        public int Add(yhqModel m)
        {
            string sql = string.Format("insert into [yhq] values ('{0}', '{1}', {2}, '{3}', '{4}', '{5}', '{6}', '{7}', {8}, {9})",
                m.mc, m.Fenlei, m.sytj, m.ksrq, m.jsrq, m.yhfs, m.yhfs1, m.yhfs2, m.flfs, m.ffzs);
            return helper.ExecuteNonQuery(sql);
        }
        /// <summary>
        /// 获取所有领取记录的方法
        /// </summary>
        /// <returns></returns>
        public List<lqjlModel> Show()
        {
            string sql = @"select lqjl.Id, yh.Name, yhq.mc, yhq.sytj, yhq.yhfs, yhq.yhfs1, lqjl.lqsh, lqjl.hxzt
                from lqjl left join yh on lqjl.yhId = yh.Id
                left join yhq on lqjl.yhqId = yhq.Id";
            return helper.GetToList<lqjlModel>(sql);
        }
    }
}
posted @ 2020-06-09 15:21  G蠢蠢  阅读(162)  评论(0编辑  收藏  举报