Skip to content

Commit

Permalink
Dev (#11)
Browse files Browse the repository at this point in the history
* Update .gitignore

* Update appsettings.Development.json

* Create appsettings.json

* Delete IdentityHostingStartup.cs

* Delete 00000000000000_CreateIdentitySchema.cs

* Delete 00000000000000_CreateIdentitySchema.Designer.cs

* Delete 20190214095704_BookEntry.Designer.cs

* Delete 20190214095704_BookEntry.cs

* Create 20231127174310_InitPhonebookContextMigration.cs

Co-Authored-By: akinin <[email protected]>

* Create 20231127174310_InitPhonebookContextMigration.Designer.cs

Co-Authored-By: akinin <[email protected]>

* Create 20231127180022_InitIdentityMigration.cs

Co-Authored-By: akinin <[email protected]>

* Create 20231127180022_InitIdentityMigration.Designer.cs

Co-Authored-By: akinin <[email protected]>

* Update ApplicationDbContextModelSnapshot.cs

Co-Authored-By: akinin <[email protected]>

* Update PhonebookContextModelSnapshot.cs

Co-Authored-By: akinin <[email protected]>

* Update PhoneBookController.cs

Co-Authored-By: akinin <[email protected]>

* Update ApplicationDbContext.cs

Co-Authored-By: akinin <[email protected]>

* Update PhonebookContext.cs

Co-Authored-By: akinin <[email protected]>

* Update SampleData.cs

Co-Authored-By: akinin <[email protected]>

* Create Dockerfile

Co-Authored-By: akinin <[email protected]>

* Update CustomMetadataProvider.cs

* Create IdentityContext.db

* Create BookEntriesViewModel.cs

* Update BookEntry.cs

* Update ErrorViewModel.cs

* Create PhoneBookContext.db

Co-Authored-By: akinin <[email protected]>

* Update PhoneEdit.csproj

Co-Authored-By: akinin <[email protected]>

* Update PhoneEdit.sln

Co-Authored-By: akinin <[email protected]>

* Update Program.cs

Co-Authored-By: akinin <[email protected]>

* Update launchSettings.json

Co-Authored-By: akinin <[email protected]>

* Delete FolderProfile.pubxml

Co-Authored-By: akinin <[email protected]>

* Create README.md

Co-Authored-By: akinin <[email protected]>

* Update ScaffoldingReadme.txt

Co-Authored-By: akinin <[email protected]>

* Create DefaultUserService.cs

Co-Authored-By: akinin <[email protected]>

* Create PhoneBookService.cs

Co-Authored-By: akinin <[email protected]>

* Delete Startup.cs

Co-Authored-By: akinin <[email protected]>

* Update _ViewImports.cshtml

Co-Authored-By: akinin <[email protected]>

* Update _ViewStart.cshtml

Co-Authored-By: akinin <[email protected]>

* Update Create.cshtml

Co-Authored-By: akinin <[email protected]>

* Update Delete.cshtml

Co-Authored-By: akinin <[email protected]>

* Update Details.cshtml

Co-Authored-By: akinin <[email protected]>

* Update Edit.cshtml

Co-Authored-By: akinin <[email protected]>

* Update Index.cshtml

Co-Authored-By: akinin <[email protected]>

* Update _Layout.cshtml

Co-Authored-By: akinin <[email protected]>

* Create _Layout.cshtml.css

Co-Authored-By: akinin <[email protected]>

* Update _LoginPartial.cshtml

Co-Authored-By: akinin <[email protected]>

* Update _ValidationScriptsPartial.cshtml

Co-Authored-By: akinin <[email protected]>

* Update bootstrap library

* Update jquery library

* Update bootstrap library

* Update _Layout.cshtml

Co-Authored-By: akinin <[email protected]>

* Create dotnet.yml

---------

Co-authored-by: akinin <[email protected]>
  • Loading branch information
shashinma and akinin authored Nov 30, 2023
1 parent 1222655 commit 7222407
Show file tree
Hide file tree
Showing 101 changed files with 56,924 additions and 17,707 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This workflow will build a .NET project

name: .NET

on:
push:
branches:
# - 'master'
- 'dev'
pull_request:
branches: [ "master" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -259,4 +259,7 @@ paket-files/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
/appsettings.json

.DS_Store
*.db*
!*.db
21 changes: 0 additions & 21 deletions Areas/Identity/IdentityHostingStartup.cs

This file was deleted.

2 changes: 1 addition & 1 deletion Areas/Identity/Pages/Account/Manage/_Layout.cshtml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@{
Layout = "/Areas/Identity/Pages/_Layout.cshtml";
Layout = "_Layout";
}

<h1>Manage your account</h1>
Expand Down
60 changes: 12 additions & 48 deletions Controllers/PhoneBookController.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Authorization.Infrastructure;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.EntityFrameworkCore;
using PhoneEdit.Data;
using PhoneEdit.Models;
Expand All @@ -25,7 +19,7 @@ public PhoneBookController(PhonebookContext context)

// GET: PhoneBook
[AllowAnonymous]
public async Task<IActionResult> Index(string currentFilter, string searchString, int? cPage)
public IActionResult Index(string? searchString, string? currentFilter, int? cPage)
{
if (searchString != null)
{
Expand All @@ -38,10 +32,8 @@ public async Task<IActionResult> Index(string currentFilter, string searchString

ViewBag.CurrentFilter = searchString;

var entries = from e in _context.Entries
select e;


var entries = _context.Entries.Select(e => e).AsEnumerable();

if (!string.IsNullOrEmpty(searchString))
{
entries = entries.Where(e => e.ToString().Contains(searchString, StringComparison.OrdinalIgnoreCase));
Expand All @@ -51,9 +43,10 @@ public async Task<IActionResult> Index(string currentFilter, string searchString

int pageSize = 25;
int pageNumber = (cPage ?? 1);
return View((await entries.ToListAsync()).ToPagedList(pageNumber,pageSize));
}

return View(entries.AsQueryable().ToPagedList(pageNumber, pageSize));
}

// GET: PhoneBook/Details/5
public async Task<IActionResult> Details(int? id)
{
Expand Down Expand Up @@ -114,45 +107,16 @@ public async Task<IActionResult> Edit(int? id)
return View(bookEntry);
}

// POST: PhoneBook/Edit/5
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Edit(int id, [Bind("Id,PersonnelNumber,Name,Position,Department,LocalPhoneNumber,CityPhoneNumber,Mail,Room, Status")] BookEntry bookEntry)
public async Task<IActionResult> Edit(int id, [Bind("Id,PersonnelNumber,Name,Position,Department,LocalPhoneNumber,CityPhoneNumber,Mail,Room")] BookEntry bookEntry)
{
if (id != bookEntry.Id)
{
return NotFound();
}

if (!VerifyPersonnelNumber(bookEntry))
{
ModelState.AddModelError(nameof(bookEntry.PersonnelNumber), "Табельный номер уже существует");
}
if (ModelState.IsValid)
{
try
{
_context.Update(bookEntry);
await _context.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException)
{
if (!BookEntryExists(bookEntry.Id))
{
return NotFound();
}
else
{
throw;
}
}
return RedirectToAction(nameof(Index));
}
return View(bookEntry);
_context.Entries.Update(bookEntry);
await _context.SaveChangesAsync();

return RedirectToAction("Index");
}

// GET: PhoneBook/Delete/5
public async Task<IActionResult> Delete(int? id)
{
Expand Down
16 changes: 6 additions & 10 deletions Data/ApplicationDbContext.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;

namespace PhoneEdit.Data
namespace PhoneEdit.Data;

public class ApplicationDbContext : IdentityDbContext
{
public class ApplicationDbContext : IdentityDbContext
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options)
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options)
{
}
}
}
Loading

0 comments on commit 7222407

Please sign in to comment.