2 этап
This commit is contained in:
parent
9365dbc456
commit
b287e4b40e
@ -15,6 +15,8 @@ namespace SchoolContracts.BindingModels
|
||||
|
||||
public decimal Price { get; }
|
||||
|
||||
public int Count { get; set; }
|
||||
|
||||
public int WorkerId { get; }
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,8 @@ namespace SchoolContracts.BindingModels
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int Count { get; set; }
|
||||
|
||||
public int ItemId { get; }
|
||||
|
||||
public int StudyId { get; }
|
||||
|
@ -10,6 +10,8 @@ namespace SchoolContracts.Models
|
||||
// Затрата на обучение
|
||||
public interface IItemForStudyModel : IId
|
||||
{
|
||||
// Количество
|
||||
int Count { get; }
|
||||
// Id затрат
|
||||
int ItemId { get; }
|
||||
|
||||
|
@ -16,6 +16,9 @@ namespace SchoolContracts.Models
|
||||
// Цена
|
||||
decimal Price { get; }
|
||||
|
||||
// Количество
|
||||
int Count { get; }
|
||||
|
||||
// Id сотрудника
|
||||
int WorkerId { get; }
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ namespace SchoolContracts.StorageContracts
|
||||
List<PaymentViewModel> GetFullList();
|
||||
List<PaymentViewModel> GetFilteredList(PaymentSearchModel model);
|
||||
PaymentViewModel? GetElement(PaymentSearchModel model);
|
||||
List<PaymentViewModel> GetPaymentsByCourses(PaymentSearchModel model);
|
||||
PaymentViewModel? Insert(PaymentBindingModel model);
|
||||
PaymentViewModel? Update(PaymentBindingModel model);
|
||||
PaymentViewModel? Delete(PaymentBindingModel model);
|
||||
|
@ -11,6 +11,8 @@ namespace SchoolContracts.ViewModels
|
||||
public class ItemForStudyViewModel: IItemForStudyModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Количество")]
|
||||
public int Count { get; set; }
|
||||
public int ItemId { get; set; }
|
||||
[DisplayName("Номер обучения")]
|
||||
public int StudyId { get; set; }
|
||||
|
@ -15,8 +15,10 @@ namespace SchoolContracts.ViewModels
|
||||
public string Name { get; set; } = string.Empty;
|
||||
[DisplayName("Цена")]
|
||||
public decimal Price { get; set; }
|
||||
[DisplayName("Количество")]
|
||||
public int Count { get; set; }
|
||||
public int WorkerId { get; set; }
|
||||
[DisplayName("Сотрудник")]
|
||||
public string WorkerName { get; set; } = string.Empty;
|
||||
public string WorkerFIO { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
85
School/SchoolDatabase/Implements/CoursesForStudyStorage.cs
Normal file
85
School/SchoolDatabase/Implements/CoursesForStudyStorage.cs
Normal file
@ -0,0 +1,85 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.StorageContracts;
|
||||
using SchoolContracts.ViewModels;
|
||||
using SchoolDatabase.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolDatabase.Implements
|
||||
{
|
||||
public class CoursesForStudyStorage: ICoursesForStudyStorage
|
||||
{
|
||||
public List<CoursesForStudyViewModel> GetFullList()
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
return context.CoursesForStudys
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public List<CoursesForStudyViewModel> GetFilteredList(CoursesForStudySearchModel model)
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
return context.CoursesForStudys
|
||||
.Where(x => x.Id == model.Id)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public CoursesForStudyViewModel? GetElement(CoursesForStudySearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new SchoolDbContext();
|
||||
if (model.Id.HasValue)//ищем по Id
|
||||
{
|
||||
return context.CoursesForStudys.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
|
||||
}
|
||||
//другие варианты поиска не реализуются (заглушка для роли клиента)
|
||||
return null;
|
||||
}
|
||||
public CoursesForStudyViewModel? Insert(CoursesForStudyBindingModel model)
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
var newCoursesForStudys = CoursesForStudy.Create(model);
|
||||
if (newCoursesForStudys != null)
|
||||
{
|
||||
context.CoursesForStudys.Add(newCoursesForStudys);
|
||||
context.SaveChanges();
|
||||
return newCoursesForStudys.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public CoursesForStudyViewModel? Update(CoursesForStudyBindingModel model)
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
var coursesForStudys = context.CoursesForStudys
|
||||
.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (coursesForStudys == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
coursesForStudys.Update(model);
|
||||
context.SaveChanges();
|
||||
return coursesForStudys.GetViewModel;
|
||||
}
|
||||
public CoursesForStudyViewModel? Delete(CoursesForStudyBindingModel model)
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
var coursesForStudys = context.CoursesForStudys
|
||||
.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (coursesForStudys == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.CoursesForStudys.Remove(coursesForStudys);
|
||||
context.SaveChanges();
|
||||
return coursesForStudys.GetViewModel;
|
||||
}
|
||||
}
|
||||
}
|
92
School/SchoolDatabase/Implements/CoursesStorage.cs
Normal file
92
School/SchoolDatabase/Implements/CoursesStorage.cs
Normal file
@ -0,0 +1,92 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.StorageContracts;
|
||||
using SchoolContracts.ViewModels;
|
||||
using SchoolDatabase.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolDatabase.Implements
|
||||
{
|
||||
public class CoursesStorage : ICoursesStorage
|
||||
{
|
||||
public List<CoursesViewModel> GetFullList()
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
return context.Coursess
|
||||
.Include(x => x.Worker)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public List<CoursesViewModel> GetFilteredList(CoursesSearchModel model)
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
return context.Coursess
|
||||
.Where(x => x.Id == model.Id)
|
||||
.Include(x => x.Worker)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public CoursesViewModel? GetElement(CoursesSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new SchoolDbContext();
|
||||
if (model.Id.HasValue)//сначала ищем по Id
|
||||
{
|
||||
return context.Coursess
|
||||
.Include(x => x.Worker)
|
||||
.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(model.Name))//затем по названию
|
||||
{
|
||||
return context.Coursess
|
||||
.Include(x => x.Worker)
|
||||
.FirstOrDefault(x => x.Name == model.Name)?.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public CoursesViewModel? Insert(CoursesBindingModel model)
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
var newCourses = Courses.Create(context, model);
|
||||
if (newCourses != null)
|
||||
{
|
||||
context.Coursess.Add(newCourses);
|
||||
context.SaveChanges();
|
||||
return newCourses.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public CoursesViewModel? Update(CoursesBindingModel model)
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
var courses = context.Coursess.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (courses == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
courses.Update(context, model);
|
||||
context.SaveChanges();
|
||||
return courses.GetViewModel;
|
||||
}
|
||||
public CoursesViewModel? Delete(CoursesBindingModel model)
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
var work = context.Coursess.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (work == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Coursess.Remove(work);
|
||||
context.SaveChanges();
|
||||
return work.GetViewModel;
|
||||
}
|
||||
}
|
||||
}
|
84
School/SchoolDatabase/Implements/CustumerStorage.cs
Normal file
84
School/SchoolDatabase/Implements/CustumerStorage.cs
Normal file
@ -0,0 +1,84 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.StorageContracts;
|
||||
using SchoolContracts.ViewModels;
|
||||
using SchoolDatabase.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolDatabase.Implements
|
||||
{
|
||||
public class CustumerStorage: ICustumerStorage
|
||||
{
|
||||
public List<CustumerViewModel> GetFullList()
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
return context.Custumers
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public List<CustumerViewModel> GetFilteredList(CustumerSearchModel model)
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
return context.Custumers
|
||||
.Where(x => x.Id == model.Id)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public CustumerViewModel? GetElement(CustumerSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new SchoolDbContext();
|
||||
if (model.Id.HasValue)//ищем по Id
|
||||
{
|
||||
return context.Custumers.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
|
||||
}
|
||||
//другие варианты поиска не реализуются (заглушка для роли клиента)
|
||||
return null;
|
||||
}
|
||||
public CustumerViewModel? Insert(CustomerBindingModel model)
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
var newCustomer = Custumer.Create(model);
|
||||
if (newCustomer != null)
|
||||
{
|
||||
context.Custumers.Add(newCustomer);
|
||||
context.SaveChanges();
|
||||
return newCustomer.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public CustumerViewModel? Update(CustomerBindingModel model)
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
var customer = context.Custumers
|
||||
.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (customer == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
customer.Update(model);
|
||||
context.SaveChanges();
|
||||
return customer.GetViewModel;
|
||||
}
|
||||
public CustumerViewModel? Delete(CustomerBindingModel model)
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
var customer = context.Custumers
|
||||
.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (customer == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Custumers.Remove(customer);
|
||||
context.SaveChanges();
|
||||
return customer.GetViewModel;
|
||||
}
|
||||
}
|
||||
}
|
86
School/SchoolDatabase/Implements/ItemForStudyStorage.cs
Normal file
86
School/SchoolDatabase/Implements/ItemForStudyStorage.cs
Normal file
@ -0,0 +1,86 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.StorageContracts;
|
||||
using SchoolContracts.ViewModels;
|
||||
using SchoolDatabase.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolDatabase.Implements
|
||||
{
|
||||
public class ItemForStudyStorage: IItemForStudyStorage
|
||||
{
|
||||
public List<ItemForStudyViewModel> GetFullList()
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
return context.ItemForStudys
|
||||
.Include(x => x.Item)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public List<ItemForStudyViewModel> GetFilteredList(ItemForStudySearchModel model)
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
return context.ItemForStudys
|
||||
.Where(x => x.Id == model.Id)
|
||||
.Include(x => x.Item)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public ItemForStudyViewModel? GetElement(ItemForStudySearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new SchoolDbContext();
|
||||
if (model.Id.HasValue)
|
||||
{
|
||||
return context.ItemForStudys
|
||||
.Include(x => x.Item)
|
||||
.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public ItemForStudyViewModel? Insert(ItemForStudyBindingModel model)
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
var newItemForStudy = ItemForStudy.Create(context, model);
|
||||
if (newItemForStudy != null)
|
||||
{
|
||||
context.ItemForStudys.Add(newItemForStudy);
|
||||
context.SaveChanges();
|
||||
return newItemForStudy.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public ItemForStudyViewModel? Update(ItemForStudyBindingModel model)
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
var itemForStudy = context.ItemForStudys.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (itemForStudy == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
itemForStudy.Update(context, model);
|
||||
context.SaveChanges();
|
||||
return itemForStudy.GetViewModel;
|
||||
}
|
||||
public ItemForStudyViewModel? Delete(ItemForStudyBindingModel model)
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
var itemForStudy = context.ItemForStudys.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (itemForStudy == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.ItemForStudys.Remove(itemForStudy);
|
||||
context.SaveChanges();
|
||||
return itemForStudy.GetViewModel;
|
||||
}
|
||||
}
|
||||
}
|
93
School/SchoolDatabase/Implements/ItemStorage.cs
Normal file
93
School/SchoolDatabase/Implements/ItemStorage.cs
Normal file
@ -0,0 +1,93 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.Models;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.StorageContracts;
|
||||
using SchoolContracts.ViewModels;
|
||||
using SchoolDatabase.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolDatabase.Implements
|
||||
{
|
||||
public class ItemStorage : IItemStorage
|
||||
{
|
||||
public List<ItemViewModel> GetFullList()
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
return context.Items
|
||||
.Include(x => x.Worker)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public List<ItemViewModel> GetFilteredList(ItemSearchModel model)
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
return context.Items
|
||||
.Where(x => x.WorkerId == model.Id)
|
||||
.Include(x => x.Worker)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public ItemViewModel? GetElement(ItemSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new SchoolDbContext();
|
||||
if (model.Id.HasValue)//сначала ищем по Id
|
||||
{
|
||||
return context.Items
|
||||
.Include(x => x.Worker)
|
||||
.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(model.Name))//затем по названию
|
||||
{
|
||||
return context.Items
|
||||
.Include(x => x.Worker)
|
||||
.FirstOrDefault(x => x.Name == model.Name)?.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public ItemViewModel? Insert(ItemBindingModel model)
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
var newItem = Item.Create(context, model);
|
||||
if (newItem != null)
|
||||
{
|
||||
context.Items.Add(newItem);
|
||||
context.SaveChanges();
|
||||
return newItem.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public ItemViewModel? Update(ItemBindingModel model)
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
var item = context.Items.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (item == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
item.Update(context, model);
|
||||
context.SaveChanges();
|
||||
return item.GetViewModel;
|
||||
}
|
||||
public ItemViewModel? Delete(ItemBindingModel model)
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
var item = context.Items.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (item == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Items.Remove(item);
|
||||
context.SaveChanges();
|
||||
return item.GetViewModel;
|
||||
}
|
||||
}
|
||||
}
|
87
School/SchoolDatabase/Implements/PaymentStorage.cs
Normal file
87
School/SchoolDatabase/Implements/PaymentStorage.cs
Normal file
@ -0,0 +1,87 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.StorageContracts;
|
||||
using SchoolContracts.ViewModels;
|
||||
using SchoolDatabase.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolDatabase.Implements
|
||||
{
|
||||
public class PaymentStorage: IPaymentStorage
|
||||
{
|
||||
public List<PaymentViewModel> GetFullList()
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
return context.Payments
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<PaymentViewModel> GetFilteredList(PaymentSearchModel model)
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
return context.Payments
|
||||
.Where(x => x.Id == model.Id)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public PaymentViewModel? GetElement(PaymentSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new SchoolDbContext();
|
||||
if (model.Id.HasValue)
|
||||
{
|
||||
return context.Payments
|
||||
.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public PaymentViewModel? Insert(PaymentBindingModel model)
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
var newPayment = Payment.Create(context, model);
|
||||
if (newPayment != null)
|
||||
{
|
||||
context.Payments.Add(newPayment);
|
||||
context.SaveChanges();
|
||||
return newPayment.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public PaymentViewModel? Update(PaymentBindingModel model)
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
var Payment = context.Payments.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (Payment == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
Payment.Update(context, model);
|
||||
context.SaveChanges();
|
||||
return Payment.GetViewModel;
|
||||
}
|
||||
|
||||
public PaymentViewModel? Delete(PaymentBindingModel model)
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
var Payment = context.Payments.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (Payment == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Payments.Remove(Payment);
|
||||
context.SaveChanges();
|
||||
return Payment.GetViewModel;
|
||||
}
|
||||
}
|
||||
}
|
83
School/SchoolDatabase/Implements/StudyStorage.cs
Normal file
83
School/SchoolDatabase/Implements/StudyStorage.cs
Normal file
@ -0,0 +1,83 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.StorageContracts;
|
||||
using SchoolContracts.ViewModels;
|
||||
using SchoolDatabase.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolDatabase.Implements
|
||||
{
|
||||
public class StudyStorage: IStudyStorage
|
||||
{
|
||||
public List<StudyViewModel> GetFullList()
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
return context.Studys
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public List<StudyViewModel> GetFilteredList(StudySearchModel model)
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
return context.Studys
|
||||
.Where(x => x.Id == model.Id)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public StudyViewModel? GetElement(StudySearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new SchoolDbContext();
|
||||
if (model.Id.HasValue)
|
||||
{
|
||||
return context.Studys
|
||||
.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public StudyViewModel? Insert(StudyBindingModel model)
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
var newStudy = Study.Create(context, model);
|
||||
if (newStudy != null)
|
||||
{
|
||||
context.Studys.Add(newStudy);
|
||||
context.SaveChanges();
|
||||
return newStudy.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public StudyViewModel? Update(StudyBindingModel model)
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
var study = context.Studys.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (study == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
study.Update(context, model);
|
||||
context.SaveChanges();
|
||||
return study.GetViewModel;
|
||||
}
|
||||
public StudyViewModel? Delete(StudyBindingModel model)
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
var study = context.Studys.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (study == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Studys.Remove(study);
|
||||
context.SaveChanges();
|
||||
return study.GetViewModel;
|
||||
}
|
||||
}
|
||||
}
|
93
School/SchoolDatabase/Implements/WorkerStorage.cs
Normal file
93
School/SchoolDatabase/Implements/WorkerStorage.cs
Normal file
@ -0,0 +1,93 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.StorageContracts;
|
||||
using SchoolContracts.ViewModels;
|
||||
using SchoolDatabase.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolDatabase.Implements
|
||||
{
|
||||
public class WorkerStorage : IWorkerStorage
|
||||
{
|
||||
public List<WorkerViewModel> GetFullList()
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
return context.Workers
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public List<WorkerViewModel> GetFilteredList(WorkerSearchModel model)
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
return context.Workers
|
||||
.Where(x => x.Id == model.Id)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public WorkerViewModel? GetElement(WorkerSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new SchoolDbContext();
|
||||
if (model.Id.HasValue)//Сначала ищем по Id
|
||||
{
|
||||
return context.Workers.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(model.Login) && string.IsNullOrEmpty(model.Password))//Затем по логину (для проверки уникальности)
|
||||
{
|
||||
return context.Workers
|
||||
.FirstOrDefault(x => x.Login == model.Login)?.GetViewModel;
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(model.Login) && !string.IsNullOrEmpty(model.Password))//Затем по логину и паролю (для входа)
|
||||
{
|
||||
return context.Workers
|
||||
.FirstOrDefault(x => x.Login == model.Login && x.Password == model.Password)?.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public WorkerViewModel? Insert(WorkerBindingModel model)
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
var newWorker = Worker.Create(model);
|
||||
if (newWorker != null)
|
||||
{
|
||||
context.Workers.Add(newWorker);
|
||||
context.SaveChanges();
|
||||
return newWorker.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public WorkerViewModel? Update(WorkerBindingModel model)
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
var worker = context.Workers
|
||||
.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (worker == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
worker.Update(model);
|
||||
context.SaveChanges();
|
||||
return worker.GetViewModel;
|
||||
}
|
||||
public WorkerViewModel? Delete(WorkerBindingModel model)
|
||||
{
|
||||
using var context = new SchoolDbContext();
|
||||
var worker = context.Workers
|
||||
.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (worker == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Workers.Remove(worker);
|
||||
context.SaveChanges();
|
||||
return worker.GetViewModel;
|
||||
}
|
||||
}
|
||||
}
|
@ -8,6 +8,7 @@ using SchoolContracts.Models;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace SchoolDatabase.Models
|
||||
{
|
||||
@ -19,6 +20,8 @@ namespace SchoolDatabase.Models
|
||||
[Required, Column(TypeName = "decimal (10,2)")]
|
||||
public decimal Price { get; private set; }
|
||||
[Required]
|
||||
public int Count { get; private set; }
|
||||
[Required]
|
||||
public int WorkerId { get; private set; }
|
||||
|
||||
// Затраты на обучение
|
||||
@ -35,6 +38,7 @@ namespace SchoolDatabase.Models
|
||||
{
|
||||
Name = model.Name,
|
||||
Price = model.Price,
|
||||
Count = model.Count,
|
||||
Worker = context.Workers.First(x => x.Id == model.WorkerId)
|
||||
};
|
||||
}
|
||||
@ -46,16 +50,26 @@ namespace SchoolDatabase.Models
|
||||
}
|
||||
Name = model.Name;
|
||||
Price = model.Price;
|
||||
Count = model.Count;
|
||||
Worker = context.Workers.First(x => x.Id == model.WorkerId);
|
||||
}
|
||||
public void UpdateCount(IItemModel? model, int count)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Count -= model.Count;
|
||||
}
|
||||
|
||||
public ItemViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Name = Name,
|
||||
Price = Price,
|
||||
WorkerId = WorkerId
|
||||
//,WorkerFIO = Worker.FIO
|
||||
Count = Count,
|
||||
WorkerId = WorkerId,
|
||||
WorkerFIO = Worker.FIO
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ namespace SchoolDatabase
|
||||
public virtual DbSet<ItemForStudy> ItemForStudys { get; set; }
|
||||
public virtual DbSet<Study> Studys { get; set; }
|
||||
public virtual DbSet<Courses> Coursess { get; set; }
|
||||
public virtual DbSet<CoursesForStudy> CoursessForStudys { get; set; }
|
||||
public virtual DbSet<CoursesForStudy> CoursesForStudys { get; set; }
|
||||
public virtual DbSet<Worker> Workers { get; set; }
|
||||
public virtual DbSet<Payment> Payments { get; set; }
|
||||
}
|
||||
|
7
School/SchoolWebApp/Models/CurrentUser.cs
Normal file
7
School/SchoolWebApp/Models/CurrentUser.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace SchoolWebApp.Models
|
||||
{
|
||||
public static class CurrentUser
|
||||
{
|
||||
public static int UserId = 0;
|
||||
}
|
||||
}
|
@ -1,5 +1,19 @@
|
||||
using SchoolBusinessLogic.BusinessLogic;
|
||||
using SchoolContracts.BusinessLogicsContracts;
|
||||
using SchoolContracts.StorageContracts;
|
||||
using SchoolDatabase.Implements;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
builder.Logging.SetMinimumLevel(LogLevel.Trace);
|
||||
builder.Logging.AddLog4Net("log4net.config");
|
||||
builder.Services.AddControllersWithViews();
|
||||
builder.Services.AddTransient<ICoursesLogic, CoursesLogic>();
|
||||
builder.Services.AddTransient<ICoursesStorage, CoursesStorage>();
|
||||
builder.Services.AddTransient<IWorkerLogic, WorkerLogic>();
|
||||
builder.Services.AddTransient<IWorkerStorage, WorkerStorage>();
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddControllersWithViews();
|
||||
|
||||
|
@ -6,4 +6,15 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="log4net.Extensions.AspNetCore" Version="1.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="8.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SchoolBUsinessLogic\SchoolBusinessLogic.csproj" />
|
||||
<ProjectReference Include="..\SchoolContracts\SchoolContracts.csproj" />
|
||||
<ProjectReference Include="..\SchoolDatabase\SchoolDatabase.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
28
School/SchoolWebApp/Views/Home/Course.cshtml
Normal file
28
School/SchoolWebApp/Views/Home/Course.cshtml
Normal file
@ -0,0 +1,28 @@
|
||||
@{
|
||||
ViewData["Title"] = "Редактирование курса";
|
||||
}
|
||||
<form method="post">
|
||||
<div hidden><input type="text" name="Id" value="@ViewBag.Courses.Id" /></div>
|
||||
<div hidden><input type="text" name="WorkerId" value="@ViewBag.Courses.WorkerId" /></div>
|
||||
<div class="row">
|
||||
<div class="col-4">Название:</div>
|
||||
<div class="col-8"><input type="text" name="Name" value="@ViewBag.Courses.Name" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Цена:</div>
|
||||
<div class="col-8"><input type="text" name="Price" value="@ViewBag.Courses.Price" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Продолжительность:</div>
|
||||
<div class="col-8"><input type="text" name="Duration" value="@ViewBag.Courses.Duration" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div><button asp-controller="Home" asp-action="UpdateCourses" class="btn btn-primary">Изменить</button></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div><button asp-controller="Home" asp-action="DeleteCourses" class="btn btn-primary">Удалить</button></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div><button asp-controller="Home" asp-action="Coursess" type="submit" class="btn btn-primary">Отмена</button></div>
|
||||
</div>
|
||||
</form>
|
34
School/SchoolWebApp/Views/Home/Coursess.cshtml
Normal file
34
School/SchoolWebApp/Views/Home/Coursess.cshtml
Normal file
@ -0,0 +1,34 @@
|
||||
@{
|
||||
ViewData["Title"] = "Курсы";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Курсы</h1>
|
||||
@if (ViewBag.Works.Count != 0)
|
||||
{
|
||||
<center>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Название</th>
|
||||
<th>Цена (в рублях)</th>
|
||||
<th>Продолжительность (в часах)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var courses in ViewBag.Coursess)
|
||||
{
|
||||
<tr>
|
||||
<td>@courses.Name</td>
|
||||
<td>@courses.Price</td>
|
||||
<td>@courses.Duration</td>
|
||||
<td><a href="/Home/Courses/@courses.Id">Изменить</a></td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</center>
|
||||
}
|
||||
<div><center><a asp-controller="Home" asp-action="CreateCourses" class="btn btn-primary">Добавить</a></center></div>
|
||||
<div>@ViewBag.Exception</div>
|
||||
</div>
|
23
School/SchoolWebApp/Views/Home/CreateCourses.cshtml
Normal file
23
School/SchoolWebApp/Views/Home/CreateCourses.cshtml
Normal file
@ -0,0 +1,23 @@
|
||||
@{
|
||||
ViewData["Title"] = "Создание курсов";
|
||||
}
|
||||
<form method="post">
|
||||
<div hidden><input type="text" name="Id" /></div>
|
||||
<div hidden><input type="text" name="WorkerId" value="@CurrentUser.UserId" /></div>
|
||||
<div class="row">
|
||||
<div class="col-4">Название:</div>
|
||||
<div class="col-8"><input type="text" name="Name" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Цена:</div>
|
||||
<div class="col-8"><input type="text" name="Price" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Длительность:</div>
|
||||
<div class="col-8"><input type="text" name="Duration" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div><button asp-controller="Home" asp-action="CreateCourses" class="btn btn-primary">Добавить</button></div>
|
||||
</div>
|
||||
</form>
|
||||
<div>@ViewBag.Exception</div>
|
19
School/SchoolWebApp/Views/Home/CreateItem.cshtml
Normal file
19
School/SchoolWebApp/Views/Home/CreateItem.cshtml
Normal file
@ -0,0 +1,19 @@
|
||||
@{
|
||||
ViewData["Title"] = "Создание занятия";
|
||||
}
|
||||
<form method="post">
|
||||
<div hidden><input type="text" name="Id" /></div>
|
||||
<div hidden><input type="text" name="WorkerId" value="@CurrentUser.UserId" /></div>
|
||||
<div class="row">
|
||||
<div class="col-4">Название:</div>
|
||||
<div class="col-8"><input type="text" name="Name" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Цена:</div>
|
||||
<div class="col-8"><input type="text" name="Price" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div><button asp-controller="Home" asp-action="CreateItem" class="btn btn-primary">Добавить</button></div>
|
||||
</div>
|
||||
</form>
|
||||
<div>@ViewBag.Exception</div>
|
21
School/SchoolWebApp/Views/Home/Enter.cshtml
Normal file
21
School/SchoolWebApp/Views/Home/Enter.cshtml
Normal file
@ -0,0 +1,21 @@
|
||||
@{
|
||||
ViewData["Title"] = "Enter";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Вход в приложение</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="col-4">Логин:</div>
|
||||
<div class="col-8"><input type="text" name="login" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Пароль:</div>
|
||||
<div class="col-8"><input type="password" name="password" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4"><input type="submit" value="Вход" class="btn btn-primary" /></div>
|
||||
</div>
|
||||
</form>
|
@ -1,8 +1,11 @@
|
||||
@{
|
||||
ViewData["Title"] = "Home Page";
|
||||
ViewData["Title"] = "Главная";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Welcome</h1>
|
||||
<p>Learn about <a href="https://learn.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
|
||||
<h1 class="display-4">Главная страница</h1>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="text-center">
|
||||
</div>
|
24
School/SchoolWebApp/Views/Home/Item.cshtml
Normal file
24
School/SchoolWebApp/Views/Home/Item.cshtml
Normal file
@ -0,0 +1,24 @@
|
||||
@{
|
||||
ViewData["Title"] = "Редактирование занятия";
|
||||
}
|
||||
<form method="post">
|
||||
<div hidden><input type="text" name="Id" value="@ViewBag.Item.Id" /></div>
|
||||
<div hidden><input type="text" name="WorkerId" value="@ViewBag.Item.WorkerId" /></div>
|
||||
<div class="row">
|
||||
<div class="col-4">Название:</div>
|
||||
<div class="col-8"><input type="text" name="Name" value="@ViewBag.Item.Name" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Цена:</div>
|
||||
<div class="col-8"><input type="text" name="Price" value="@ViewBag.Item.Price" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div><button asp-controller="Home" asp-action="UpdateItem" class="btn btn-primary">Изменить</button></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div><button asp-controller="Home" asp-action="DeleteItem" class="btn btn-primary">Удалить</button></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div><button asp-controller="Home" asp-action="Items" type="submit" class="btn btn-primary">Отмена</button></div>
|
||||
</div>
|
||||
</form>
|
32
School/SchoolWebApp/Views/Home/Items.cshtml
Normal file
32
School/SchoolWebApp/Views/Home/Items.cshtml
Normal file
@ -0,0 +1,32 @@
|
||||
@{
|
||||
ViewData["Title"] = "Занятия";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Занятия</h1>
|
||||
@if (ViewBag.Items.Count != 0)
|
||||
{
|
||||
<center>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Название</th>
|
||||
<th>Цена (в рублях)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ViewBag.Items)
|
||||
{
|
||||
<tr>
|
||||
<td>@item.Name</td>
|
||||
<td>@item.Price</td>
|
||||
<td><a href="/Home/Item/@item.Id">Изменить</a></td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</center>
|
||||
}
|
||||
<div><center><a asp-controller="Home" asp-action="CreateItem" class="btn btn-primary">Добавить</a></center></div>
|
||||
<div>@ViewBag.Exception</div>
|
||||
</div>
|
36
School/SchoolWebApp/Views/Home/Register.cshtml
Normal file
36
School/SchoolWebApp/Views/Home/Register.cshtml
Normal file
@ -0,0 +1,36 @@
|
||||
@{
|
||||
ViewData["Title"] = "Регистрация";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Регистрация</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="col-4">Логин:</div>
|
||||
<div class="col-8"><input type="text" name="Login" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Почта:</div>
|
||||
<div class="col-8"><input type="text" name="Email" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">ФИО:</div>
|
||||
<div class="col-8"><input type="text" name="FIO" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Должность:</div>
|
||||
<div class="col-8"><input type="text" name="Post" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Пароль:</div>
|
||||
<div class="col-8"><input type="password" name="Password" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4"><input type="submit" value="Регистрация" class="btn btn-primary" /></div>
|
||||
</div>
|
||||
</form>
|
||||
<div>
|
||||
<div>@ViewBag.Exception</div>
|
||||
</div>
|
@ -3,47 +3,87 @@
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>@ViewData["Title"] - SchoolWebApp</title>
|
||||
<title>@ViewData["Title"]</title>
|
||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
|
||||
<link rel="stylesheet" href="~/SchoolWebApp.styles.css" asp-append-version="true" />
|
||||
<link rel="stylesheet" href="~/WebApplication2.styles.css" asp-append-version="true" />
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">SchoolWebApp</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
|
||||
aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
|
||||
<ul class="navbar-nav flex-grow-1">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<div class="container">
|
||||
<main role="main" class="pb-3">
|
||||
@RenderBody()
|
||||
</main>
|
||||
</div>
|
||||
<style type="text/css">
|
||||
.body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
<footer class="border-top footer text-muted">
|
||||
.container {
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.page {
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.footer {
|
||||
padding: 20px;
|
||||
margin-top: auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.containerFooter {
|
||||
display: inline-block;
|
||||
}
|
||||
</style>
|
||||
<div class="page">
|
||||
<header>
|
||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">Школа "Опять учиться"</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
|
||||
aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="nav col-12 col-md-auto mb-2 justify-content-center mb-md-0">
|
||||
<ul class="navbar-nav flex-grow-1">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Study" asp-action="Index">Обучения</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Courses" asp-action="Index">Курсы</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Item" asp-action="Index">Затраты</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Report" asp-action="Index">Отчеты</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-muted" asp-area="" asp-controller="Payment" asp-action="Index">Оплата</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<partial name="_LoginPartial" />
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<div class="container">
|
||||
© 2024 - SchoolWebApp - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||
<main role="main" class="pb-3">
|
||||
@RenderBody()
|
||||
</main>
|
||||
</div>
|
||||
</footer>
|
||||
<footer class="border-top footer text-muted align-items-center">
|
||||
<div class="containerFooter">
|
||||
© 2024 - Школа <a asp-area="" asp-controller="Home" asp-action="Index">"Опять учиться"</a>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||
@await RenderSectionAsync("Scripts", required: false)
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
16
School/SchoolWebApp/log4net.config
Normal file
16
School/SchoolWebApp/log4net.config
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<log4net>
|
||||
<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
|
||||
<file value="c:/BlacksmithWorkshopRestApi.log"/>
|
||||
<appendToFile value="true"/>
|
||||
<maximumFileSize value="100KB"/>
|
||||
<maxSizeRollBackups value="2"/>
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<conversionPattern value="%date %5level %logger.%method [%line] - MESSAGE: %message%newline %exception"/>
|
||||
</layout>
|
||||
</appender>
|
||||
<root>
|
||||
<level value="TRACE"/>
|
||||
<appender-ref ref="RollingFile"/>
|
||||
</root>
|
||||
</log4net>
|
Loading…
Reference in New Issue
Block a user