Example #1
0
        public HttpStatusCode Delete(RosterDeleteRequest request)//need to get student id and class id
        {
            var repo = new RosterRepository();

            repo.DeleteStudentFromClass(request);

            return(HttpStatusCode.OK);
        }
        //using Dapper and because we have a combo id use a request object to pass through this method
        public void DeleteStudentFromClass(RosterDeleteRequest request)
        {
            using (var cn = new SqlConnection(Config.GetConnectionString()))
            {
                var p = new DynamicParameters();
                p.Add("@ClassID", request.ClassID);
                p.Add("@StudentID", request.StudentID);

                cn.Execute("RemoveStudentFromClass", p, commandType: CommandType.StoredProcedure);//nothing to return
            }
        }