using System; using System.Collections.Generic; using System.Linq; using dccdc.Models; using Dapper; using System.Data; namespace dccdc.DAL { public class professionalExamProjectResultImgsDal { public int saveResultImgs(List list) { using (var conn = CommHelper.GetSqlConnection()) { string delsql = "delete from professionalExam_project_result_imgs where person_id=@person_id and project_id=@project_id and project_result_id=@project_result_id"; conn.Execute(delsql, list.First()); string sql = "insert into professionalExam_project_result_imgs values"; list.ForEach(item => { sql += "('" + item.person_id + "','" + item.project_id + "','" + item.img_path + "','" + item.project_result_id + "','" + item.img_type + "'),"; }); return conn.Execute(sql.TrimEnd(',')); } } public List getCaiChaoInfo(int resultId) { using (IDbConnection conn = CommHelper.GetSqlConnection()) { string sql = "select * from professionalExam_project_result_imgs where project_result_id = '" + resultId + "' "; return conn.Query(sql).ToList(); } } } }