示例#1
0
        public async Task InvokeAsync(HttpContext httpContext, IStudentsSerivceDb serivceDb)
        {
            if (httpContext.Request != null)
            {
                string method  = httpContext.Request.Method;
                string path    = httpContext.Request.Path;
                string bodyStr = "";
                using (StreamReader reader = new StreamReader(httpContext.Request.Body, Encoding.UTF8, true, 1024, true))
                {
                    bodyStr = await reader.ReadToEndAsync();
                }
                string query  = httpContext.Request.QueryString.ToString();
                string logStr = string.Concat("Method: ", method, '\n', "Path: ", path, '\n', "Query: ", query, '\n', "Request body:", '\n', bodyStr);
                serivceDb.logIntoFile(logStr);
            }

            if (_next != null)
            {
                await _next(httpContext);
            }
        }
示例#2
0
 public StudentsController(IStudentsSerivceDb studentsSerivceDb)
 {
     _studentsSerivceDb = studentsSerivceDb;
 }
 public EnrollmentsController(IStudentsSerivceDb serivice)
 {
     _service = serivice;
 }
 public StudentsController(IStudentsSerivceDb db)
 {
     _dbService = db;
 }