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
namespace TodoProject.Models { | |
public class TodoItem { | |
public long Id { get; set; } | |
public string Item { get; set; } | |
public bool IsActive { get; set; } | |
} | |
} |
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 Microsoft.EntityFrameworkCore; | |
namespace TodoProject.Models{ | |
public class TodoContext : DbContext { | |
public TodoContext(DbContextOptions<TodoContext> options) : base(options) | |
{ | |
} |
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 System.ComponentModel.DataAnnotations; | |
using System.ComponentModel.DataAnnotations.Schema; | |
namespace EFCore.Models { | |
[Table ("PRODUCT")] | |
public class Product { | |
[Key] | |
[Column ("ID")] |
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 Microsoft.EntityFrameworkCore; | |
namespace EFCore.Models { | |
public class EFContext : DbContext { | |
private const string connectionString = "Server=.\\;Database=EFCore;Trusted_Connection=True;"; | |
protected override void OnConfiguring (DbContextOptionsBuilder optionsBuilder) { | |
optionsBuilder.UseSqlServer (connectionString); |
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 Microsoft.EntityFrameworkCore.Metadata; | |
using Microsoft.EntityFrameworkCore.Migrations; | |
namespace EFCore.Migrations | |
{ | |
public partial class FirstMigration : Migration | |
{ | |
protected override void Up(MigrationBuilder migrationBuilder) | |
{ | |
migrationBuilder.CreateTable( |
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
//Sorting Algorithm | |
function sortArray(arr) { | |
let temp; | |
for (let i = 0; i < arr.length; i++) { | |
if (arr[i] > arr[i + 1]) { | |
temp = arr[i]; | |
arr[i] = arr[i + 1]; | |
arr[i + 1] = temp; | |
console.log(arr); | |
return sortArray(arr); |
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
function reverseString(s) { | |
try { | |
let SplitString = s.split(""); | |
let ReversedArray = []; | |
for (let i = SplitString.length - 1, j = 0; i > -1; i-- , j++) { | |
ReversedArray[j] = SplitString[i]; | |
} | |
console.log(ReversedArray.join("")); //4321 | |
} catch (ex) { | |
console.log(ex.message) |
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
function Factorial(n) { | |
if (n === 1) { | |
return n; | |
} else { | |
return n * Factorial(n - 1); | |
} | |
} | |
Factorial(3); //6 |
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
let getLastItem = items => { | |
console.log(items[items.length - 1]); | |
} | |
getLastItem([10, 2, 20, 11000, 32, 123, 241312, 32142, 32131]); |
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
let displayArrayElements = array => { | |
array.forEach((value) => { | |
console.log(value); | |
}); | |
} | |
let numArray = [21,23,12321,312,312,312,3,14,12,4,32,53,5,234,1,32,13,12,41,321,4,124]; | |
displayArrayElements(numArray); |
OlderNewer