This file contains 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 class ProductDto | |
{ | |
public string Name { get; set; } | |
public double UnitPrice { get; set; } | |
} |
This file contains 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.Collections.Generic; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using Microsoft.AspNetCore.Mvc; | |
using Microsoft.EntityFrameworkCore; | |
[Route("api/[controller]")] | |
public class ProductsController:Controller | |
{ | |
private readonly ProductDbContext _context; |
This file contains 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; | |
using Microsoft.AspNetCore.Builder; | |
using Microsoft.AspNetCore.Http; | |
using Microsoft.EntityFrameworkCore; | |
using Microsoft.Extensions.DependencyInjection; | |
using Microsoft.Extensions.Hosting; | |
var builder = WebApplication.CreateBuilder(args); | |
builder.Services.AddDbContext<ProductDbContext>(options => options.UseInMemoryDatabase("Products")); |
This file contains 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 class ProductDbContext:DbContext{ | |
public ProductDbContext(DbContextOptions context):base(context) | |
{ | |
} | |
public DbSet<Product> Products{get;set;} | |
} |
This file contains 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 class Product{ | |
public int Id { get; set; } | |
public string Name { get; set; } | |
public double UnitPrice { get; set; } | |
} |
This file contains 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
// Product tipinde listemizi oluşturup ürünleri ekledik. | |
List<string> products = new List<string> | |
{ | |
"Sony Playstation 5 Oyun Konsolu", | |
"Xbox Series S Oyun Konsolu", | |
"Monster Abra A5 V9.2.2 Laptop", | |
"Xiomia Mi Band 5 Akıllı Biileklik", | |
"Sandisk Ultra 3D 500 GB Nvme SSD" | |
}; |
This file contains 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
// Product tipinde listemizi oluşturup ürünleri ekledik. | |
List<string> products = new List<string> | |
{ | |
"Sony Playstation 5 Oyun Konsolu", | |
"Xbox Series S Oyun Konsolu", | |
"Monster Abra A5 V9.2.2 Laptop", | |
"Xiomia Mi Band 5 Akıllı Biileklik", | |
"Sandisk Ultra 3D 500 GB Nvme SSD" | |
}; | |
This file contains 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
int[] numbers = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; | |
//LINQ sorgu sözdizimi | |
var query = from number in numbers | |
where number < 3 | |
select number; | |
//LINQ metod sözdizimi | |
var method = numbers.Where(n => n < 3); |
This file contains 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; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Data; | |
using System.Drawing; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Windows.Forms; |
This file contains 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; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Data; | |
using System.Drawing; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Windows.Forms; |
NewerOlder