标签:mode nbsp date list() color data put and model
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DAL { using System.Data.Entity; using System.Data.SqlClient; using System.Data; using MODEL; public class StudentDAl { StudentDbContext dbcontext = new StudentDbContext(); public int Add(int ClassCode, string StudentName, int Gender) { SqlParameter[] parameter = new SqlParameter[] { new SqlParameter("@ClassCode",ClassCode), new SqlParameter("@StudentName",StudentName), new SqlParameter("@Gender",Gender) }; return dbcontext.Database.ExecuteSqlCommand("exec proc_AddStudent @ClassCode,@StudentName,@Gender", parameter); } public List<AllData> GetStudent(SqlParameter[] parameter) { return dbcontext.Database.SqlQuery<AllData>("exec proc_getStudent @Dpage,@Count output,@ClassCode,@SchoolCode,@StudentName", parameter).ToList(); } public int Delete(int StudentId) { return dbcontext.Database.ExecuteSqlCommand("exec proc_Delete @StudentId", new SqlParameter("@StudentId", StudentId)); } public int Update(int ClassCode, string StudentName, int Gender,int StudentId) { SqlParameter[] parameter = new SqlParameter[] { new SqlParameter("@ClassCode",ClassCode), new SqlParameter("@StudentName",StudentName), new SqlParameter("@Gender",Gender), new SqlParameter("@StudentId",StudentId) }; return dbcontext.Database.ExecuteSqlCommand("exec proc_update @StudentId , @ClassCode , @StudentName , @Gender", parameter); } public AllData Getid(int StudentId) { var s = dbcontext.Database.SqlQuery<AllData>("exec get_fan @StudentId ", new SqlParameter("@StudentId", StudentId)); return s.FirstOrDefault(); } } }
标签:mode nbsp date list() color data put and model
原文地址:https://www.cnblogs.com/mamingyuan/p/9387942.html