Exemplo n.º 1
0
        public IActionResult NewUsers([FromBody] List <User> userList)
        {
            #region InsertingOnSqlServer
            _timeMeasurement.StartWatch();

            _userOperation.InsertUsers(userList, DbType.SqlServer);

            _timeMeasurement.StopWatch();

            TimeSpan spentTimeOnSqlServer = _timeMeasurement.PrintTimeSpent();
            #endregion

            _timeMeasurement.ResetWatch();

            #region InsertingOnMongoDB
            _timeMeasurement.StartWatch();

            _userOperation.InsertUsers(userList, DbType.MongoDB);

            _timeMeasurement.StopWatch();

            TimeSpan spentTimeOnMongoDB = _timeMeasurement.PrintTimeSpent();
            #endregion

            return(Json(new { elapsed_Time_On_SQL_Server = spentTimeOnSqlServer.ToString(), elapsed_Time_On_MongoDB = spentTimeOnMongoDB.ToString() }));
        }