Beispiel #1
0
 //绑定下拉
 public List <PingjiaModel> Band()
 {
     using (var conn = new SqlConnection(SQL))
     {
         conn.Open();
         SqlCommand cmd = conn.CreateCommand();
         cmd.CommandText = "select distinct Amessage ,case Amessage when 1 then '满意' when 2 then '一般' else '不满意' end Apj from Ashop  ";
         DataTable      dt = new DataTable();
         SqlDataAdapter da = new SqlDataAdapter(cmd);
         da.Fill(dt);
         List <PingjiaModel> amodels = new List <PingjiaModel>();
         foreach (DataRow dr in dt.Rows)
         {
             PingjiaModel a = new PingjiaModel();
             a.Apj      = dr["Apj"].ToString();
             a.Amessage = Convert.ToInt32(dr["Amessage"].ToString());
             amodels.Add(a);
         }
         return(amodels);
     }
 }
Beispiel #2
0
 // POST: api/Pingjia
 public int Post([FromBody] PingjiaModel m)
 {
     return(dal.Add(m));
 }
Beispiel #3
0
        //添加
        public int Add(PingjiaModel m)
        {
            string sql = string.Format("insert into Ashop values('{0}','{1}','{2}','{3}','{4}')", m.Pid, m.Uname, m.Amessage, m.Ainfor, m.Atime);

            return(DBHelper.ExecuteNonQuery(sql));
        }