public async Task <coursedetailsmodel> GetCourseDetails()
        {
            coursedetailsmodel coursedetails = new coursedetailsmodel();

            using (IDbConnection conn = Connection)
            {
                try
                {
                    var sqlparam = new DynamicParameters();
                    var result   = conn.QueryMultiple(sql: "ams.getCourseDetails", param: sqlparam, commandType: CommandType.StoredProcedure);
                    coursedetails.courses = result.Read <coursenames>().AsList();
                    coursedetails.grades  = result.Read <CourseGrades>().AsList();
                    coursedetails.levels  = result.Read <CourseLevels>().AsList();
                    return(coursedetails);
                }
                catch (Exception e)
                {
                    Console.WriteLine("Error", e);
                    throw;
                }
            }
        }
Example #2
0
        public async Task <IActionResult> GetCourseDetails()
        {
            coursedetailsmodel coursedetails = await this._courses.GetCourseDetails();

            return(Ok(coursedetails));
        }