This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public async Task<IActionResult> Example(int? page, int? rows) | |
| { | |
| IList<object> entities = await _service.Get(); | |
| if (page != null && page > 0 && rows != null && rows > 0) | |
| { | |
| entities = query.Skip((int)(rows * (page - 1))).Take((int)rows).ToList(); | |
| } | |
| else | |
| entities = query.ToList(); | |
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?php | |
| function DateVasc($data){ | |
| if(count(explode("/",$data)) > 1){ | |
| return str_replace('/','-',implode("-",array_reverse(explode("/",$data)))); | |
| }elseif(count(explode("-",$data)) > 1){ | |
| return str_replace('-','/',(implode("/",array_reverse(explode("-",$data))))); | |
| } | |
| } | |
| echo ''; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | //Use => [ app.UseRequestResponseLogging() ] inside [Class: Startup; Method: Configure;]. | |
| using Microsoft.AspNetCore.Builder; | |
| namespace Vasconcellos.WebAPI.Extensions | |
| { | |
| /// <summary> | |
| /// RequestResponseLoggingMiddlewareExtensions | |
| /// </summary> | |
| /// <remarks> | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | //Note: Before using these two functions read this | |
| //https://docs.microsoft.com/pt-br/aspnet/mvc/overview/security/preventing-open-redirection-attacks | |
| public static class PreventingRedirectionAttacksForOtherDomains | |
| { | |
| public static bool CheckURLValid(string url) | |
| { | |
| return Uri.TryCreate(url, UriKind.Absolute, out Uri uriResult) && (uriResult.Scheme == Uri.UriSchemeHttp); | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | using AutoMapper; | |
| using Vasconcellos.WebAPI.Entity; | |
| using Vasconcellos.WebAPI.Model; | |
| using Microsoft.AspNetCore.Http; | |
| using Microsoft.AspNetCore.Mvc; | |
| using Microsoft.EntityFrameworkCore; | |
| using Microsoft.Extensions.Logging; | |
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | --SQL to close all connections and drop database | |
| USE [master]; | |
| DECLARE @DatabaseName VARCHAR(MAX) = 'MyDatabaseName' --to change | |
| DECLARE @kill VARCHAR(8000) = ''; | |
| SELECT @kill = @kill + 'kill ' + CONVERT(VARCHAR(5), session_id) + ';' | |
| FROM sys.dm_exec_sessions | |
| WHERE database_id = db_id(@DatabaseName) | |
| EXEC(@kill); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?php | |
| if(empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "off"){ | |
| $redirect = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; | |
| header('HTTP/1.1 301 Moved Permanently'); | |
| header('Location: ' . $redirect); | |
| exit(); | |
| } | |
| ?> | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | var schoolID = 77; | |
| var classId = 3; | |
| var url = 'https://udemy.com.br/Cursos?schoolID='+schoolID+'&classId='+classId; | |
| var callBackParameter = {}; | |
| var callBackFunction = function(callBackParameter, ajax){ | |
| let objResponse = JSON.parse(ajax.responseText); | |
| console.log('Response Object', objResponse); | |
| }; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | var url = 'https://udemy.com.br/OpenClass'; | |
| var obj = { schoolID: 77 , classId: 3}; | |
| var callBackParameter = {}; | |
| var callBackFunction = function(ajax, callBackParameter) { | |
| let objResponse = JSON.parse(ajax.responseText); | |
| console.log('Response Object', objResponse); | |
| }; | |
| var callBackErrorParamater = {}; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | void Main() | |
| { | |
| var x = 19; | |
| var y = 7; | |
| Console.WriteLine($"Factorial of x={x}, result={Factorial(x)}.\n"); | |
| Console.WriteLine($"Multiplication of x*y={x}*{y}={Multiplication(x, y)}.\n"); | |
| Console.WriteLine($"Binary of x={x}, result={DecimalToBinary(x)}.\n"); | |
| } | |
| public long Factorial(long x) |