Skip to content

Instantly share code, notes, and snippets.

@varsi94
varsi94 / Startup.cs
Created January 4, 2023 07:36
ASP.NET Core - 2 React apps - fixed
app.Map("/admin", adminApp =>
{
adminApp.Use(async (context, next) =>
{
context.Request.Path = new PathString($"/admin/{context.Request.Path.Value}");
await next();
});
adminApp.UseSpa(c =>
{
c.UseProxyToSpaDevelopmentServer(new Uri("http://localhost:3001/admin/"));
@varsi94
varsi94 / Startup.cs
Created January 4, 2023 07:34
ASP.NET Core - 2 React apps - initial code
app.Map("/admin", adminApp => {
adminApp.UseSpa(c => {
c.UseProxyToSpaDevelopmentServer(new Uri("http://localhost:3001/admin/"));
});
});
app.UseSpa(c => {
c.UseProxyToSpaDevelopmentServer("http://localhost:3000");
});
public class ProductDetailsViewModel
{
public string ProductName { get; set; }
public decimal UnitPrice { get; set; }
public decimal UnitsInStock { get; set; }
public bool Discontinued { get; set; }
<div class="form-group col-md-3">
<label for="range">Price range:</label>
<input type="text" id="range" readonly style="border: 0px font-weight:bold" />
</div>
<div class="form-group col-md-7">
<div id="slider-range"></div>
</div>
@varsi94
varsi94 / ListProductInRange.cshtml
Created March 11, 2018 14:07
JQuery UI megvalósítás
@using (Ajax.BeginForm("ListProductInRangeAjax", "Product", ajaxOptions, new { @class = "form-inline", style = "margin-bottom: 20px", id = "filter-form" }))
{
@*<div class="form-group col-md-5">
<label for="minPrice">Min price:</label>
<input type="number" step="0.01" name="minPrice" class="form-control" id="minPrice" />
</div>
<div class="form-group col-md-5">
<label for="maxPrice">Max price:</label>
<input type="number" step="0.01" name="maxPrice" class="form-control" id="maxPrice" />
@varsi94
varsi94 / Edit.cshtml
Last active March 11, 2018 14:22
Edit megvalósítása
@model Web.ViewModels.EditProductViewModel
@{
ViewBag.Title = "Edit";
}
<h2>Edit</h2>
@using (Html.BeginForm())
{
@varsi94
varsi94 / Details.cshtml
Last active March 10, 2018 21:01
Details nézet generálása
@model Web.ViewModels.ProductDetailsViewModel
@{
ViewBag.Title = "Details";
}
<h2>Details</h2>
<div>
<h4>ProductDetailsViewModel</h4>
public ActionResult MasterDetail()
{
return View(productService.ListAllProducts());
}
public ActionResult ProductDetails(int productId)
{
return Json(productService.GetProduct(productId), JsonRequestBehavior.AllowGet);
}
@varsi94
varsi94 / UserService.cs
Created August 30, 2017 18:32
UserService
using MVCTanf.Dal;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MVCTanf.Bll
{
public class UserService
@varsi94
varsi94 / ProductService.cs
Created August 30, 2017 18:13
ProductName check
public bool HasProductWithName(int? productId, string name)
{
var items = uow.ProductRepository.List().Where(p => p.ProductName == name);
if (productId.HasValue)
{
items = items.Where(p => p.ProductId == productId.Value);
}
return items.Any();
}