Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 14d4cce

Browse files
author
kadir.avci
committed
Added master-detail page
1 parent d8dbb02 commit 14d4cce

File tree

26 files changed

+1237
-210
lines changed

26 files changed

+1237
-210
lines changed
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

‎Data/Data.csproj‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@
44
<TargetFramework>netcoreapp2.2</TargetFramework>
55
</PropertyGroup>
66

7+
<ItemGroup>
8+
<None Remove="appsettings.Development.json" />
9+
<None Remove="appsettings.json" />
10+
</ItemGroup>
11+
12+
<ItemGroup>
13+
<Content Include="appsettings.Development.json">
14+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
15+
</Content>
16+
<Content Include="appsettings.json">
17+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
18+
</Content>
19+
</ItemGroup>
20+
721
<ItemGroup>
822
<Folder Include="Helpers\" />
923
</ItemGroup>

‎Data/appsettings.Development.json‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Debug",
5+
"System": "Information",
6+
"Microsoft": "Information"
7+
}
8+
}
9+
}

‎Data/appsettings.json‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"ConnectionStrings": {
3+
//"DefaultConnection": "Data Source=KAVCI;Initial Catalog=ProductVueJs;Persist Security Info=True;User ID=sa;Password=sa;MultipleActiveResultSets=True;Connect Timeout=180",
4+
"AppDbContext": "Data Source=KAVCI;Initial Catalog=ProductVueJs;Persist Security Info=True;User ID=sa;Password=sa;MultipleActiveResultSets=True;Connect Timeout=180"
5+
}
6+
}

‎Model/Models/Product.cs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public class Product
2020
[DataType(DataType.EmailAddress)]
2121
[Required(ErrorMessage = "Email is required.")]
2222
[StringLength(20)]
23+
[RegularExpression(@"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}", ErrorMessage = "Please enter a valid email address")]
2324
public string Email { get; set; }
2425

2526
[Display(Name = "Password")]
@@ -31,7 +32,7 @@ public class Product
3132
[Display(Name = "Price")]
3233
[Required(ErrorMessage = "Price is required.")]
3334
[DisplayFormat(DataFormatString = "{0:N2}", ApplyFormatInEditMode = true)]
34-
[RegularExpression("[0,9]")]
35+
[RegularExpression(@"^\d*([.,]*\d{1,4})$")]
3536
public decimal Price { get; set; }
3637

3738
public DateTime CreatedDate { get; set; }

‎Model/ViewModels/ProductActivityVM.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
using Model.Models;
2-
using System;
32
using System.Collections.Generic;
4-
using System.Text;
53

64
namespace Model.ViewModels
75
{
86
public class ProductActivityVM
97
{
8+
public Product Product { get; set; }
9+
public ProductActivity ProductActivity { get; set; }
1010
public IList<Product> Products { get; set; }
1111
public IList<ActivityType> ActivityTypes { get; set; }
1212
public IList<WareHouse> WareHouses { get; set; }

‎VueJsTutorial/Controllers/ProductActivityController.cs‎

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,17 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Threading.Tasks;
5-
using Data.UnitOfWork;
1+
using Data.UnitOfWork;
62
using Microsoft.AspNetCore.Http;
73
using Microsoft.AspNetCore.Mvc;
84
using Model.Models;
95
using Model.ViewModels;
6+
using System.Linq;
7+
using System.Threading.Tasks;
108

119
namespace VueJsTutorial.Controllers
1210
{
1311
public class ProductActivityController : Controller
1412
{
1513
private readonly IUnitOfWork _uow;
1614

17-
public ProductActivityController()
18-
{
19-
_uow = new UnitOfWork(new AppDbContext());
20-
}
21-
2215
public ProductActivityController(IUnitOfWork uow)
2316
{
2417
_uow = uow;
@@ -31,6 +24,8 @@ public async Task<IActionResult> Index()
3124

3225
public void FormInit(ProductActivityVM model)
3326
{
27+
model.Product = new Product();
28+
model.ProductActivity = new ProductActivity();
3429
model.ActivityTypes = _uow.Repository<ActivityType>().QueryNoTracking(x => x.IsActive).ToList();
3530
model.WareHouses = _uow.Repository<WareHouse>().QueryNoTracking(x => x.IsActive).ToList();
3631
}
@@ -49,10 +44,9 @@ public async Task<IActionResult> Form(ProductActivityVM model, IFormCollection f
4944
{
5045
if (ModelState.IsValid)
5146
{
52-
5347
}
5448

5549
return View();
5650
}
5751
}
58-
}
52+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /