コード例 #1
0
        /// <summary>
        /// Add the student to list
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public async Task <ResponseDto> AddStudentAsync(StudentDto dto)
        {
            IDbConnection connection = Connection;

            dto.UpdateCreatedAuditFields();
            string sql = string.Format("insert into StudentManagement (FirstName, LastName, Age, Gpa,ClassId, CreatedDate) values ('{0}', '{1}', {2}, {3},{4}, '{5}')",
                                       dto.FirstName, dto.LastName, dto.Age, dto.Gpa, dto.ClassId, dto.CreatedDate);
            var data = await connection.ExecuteAsync(sql, null, transaction : Transaction);

            return(new ResponseDto()
            {
                ResponseCode = ResponseCode.SUCCESS
            });
        }