Skip to content

Instantly share code, notes, and snippets.

View chaudarywajid's full-sized avatar

Wajid Khan chaudarywajid

View GitHub Profile
@chaudarywajid
chaudarywajid / MVCDesign.cs
Created October 28, 2022 10:31
MVC Design Pattern
Controller
public class HumanController : Controller {
private readonly HumanContext _context;
public HumanController(HumanContext context){
_context = context;
}
public async Task Index() {
return View(await _context.Humans.ToListAsync());
@chaudarywajid
chaudarywajid / OrderListing.cshtml
Created September 22, 2022 14:42
List Order Front End View
<!-- Table -->
<section>
<h2>Order List</h2>
<div class="table-wrapper">
<table id="mainGrid" class="alt">
<thead>
<tr>
<th>Order No.</th>
<th>Order Date</th>
<th>Customer</th>
@chaudarywajid
chaudarywajid / AddToCart.cs
Created September 22, 2022 14:30
Web API to Add Item into Cart
[HttpPost("addcart")]
public IActionResult AddCart(int userId, int productId)
{
try
{
var isProductAlreadyAdded = userCartEntity
.FindBy(a => a.UserId == userId && a.ProductId == productId && !a.IsDeleted).Any();
if (!isProductAlreadyAdded)
{
var userCart = new UserCartEntity
Example in C#
var dictionary = new Dictionary<string, string>
{
{"٠", "0"},{"١", "1"},{"٢", "2"},{"٣", "3"},
{"٤", "4"},{"٥", "5"},{"٦", "6"},{"٧", "7"},
{"٨", "8"},{"٩", "9"},
};
string digit = input.Substring(this. txtNumber.Text.Length - 1);
char[] NumberChars = "٠١٢٣٤٥٦٧٨٩0123456789".ToCharArray();