Оглавление ВВЕДЕНИЕ 1 1 Техническое задание 3 1.1 Основание для разработки 3 1.2 Назначение разработки 3 1.3 Требования к программе 3 1.3.1 Описание предметной области 3 1.3.2 Требования к входным и выходным данным 5 1.3.3 Требования пользователя к интерфейсу 5 1.3.4 Требования к надежности 7 1.3.5 Условия эксплуатации 7 1.3.6 Требования к составу и параметрам технических средств 7 1.3.7 Требования к информационной и программной 7 1.4 Требования к программной документации 8 1.5 Стадии и этапы разработки 8 1.3 Порядок контроля и приемки 8 2 Технический проект 9 2.1 Словарь предметной области программного изделия 9 2.2 Описание моделей данных 13 2.2 Создание схем данных 15 3. Рабочий проект 16 3.1 Спецификация компонентов и классов программ 16 Модули и объекты интерфейса пользователя 16 3.1.1 Описание объектов интерфейса программы 16 3.1.2 Описание объектов интерфейса программы 19 ЗАКЛЮЧЕНИЕ 25 CПИСОК ИСПОЛЬЗОВАННЫХ ИСТОЧНИКОВ 26 ПРИЛОЖЕНИЕ 27
Фрагмент для ознакомления
PasswordSignInAsync(model.Email, model.Password, model.RememberMe, lockoutOnFailure: false); if (result.Succeeded) { return RedirectToAction("Index", "Home"); }ModelState.AddModelError(string.Empty, "Invalid login attempt.");}returnView(model); } // Действие для выхода из системы[HttpPost] public async Task Logout() { await _signInManager.SignOutAsync(); return RedirectToAction("Index", "Home"); }}using Microsoft.AspNetCore.Authorization;using Microsoft.AspNetCore.Identity;using Microsoft.AspNetCore.Mvc;using Microsoft.EntityFrameworkCore;using WebAppHealthyEating.Data;using WebAppHealthyEating.Data.Model;using WebAppHealthyEating.Models;namespace WebAppHealthyEating.Controllers{ [Authorize] public class ArticleController : Controller { private readonlyUserManager _userManager; private readonlySignInManager _signInManager; private readonlyApplicationDbContextapplicationDbContext; public ArticleController(ApplicationDbContextapplicationDbContext, UserManager userManager, SignInManager signInManager) {this.applicationDbContext = applicationDbContext;this._userManager = userManager;this._signInManager = signInManager; } public IActionResultAdd() { return View(); } public async Task ArticleIndex() { var articlesList = await applicationDbContext.Articles.ToListAsync(); var userList = await applicationDbContext.Users.ToListAsync(); var query = from article in articlesList join user in userList on article.AuthorId equals user.Id select new Article { Id = article.Id, Title = article.Title,SubTitle = article.SubTitle,AuthorId = article.AuthorId, Author = user, PublicationDate = article.PublicationDate, Text = article.Text, URL = article.URL }; var result = query.ToList(); return View(articlesList); } [HttpPost] public async Task AddNewArticle(ArticleViewModeladdNewArticle) { if (_signInManager.IsSignedIn(User)) { var user = await _userManager.GetUserAsync(User); var article = new Article { Id = Guid.NewGuid(), Title = addNewArticle.Title, Author = user,AuthorId = user.Id,PublicationDate = System.DateTime.Today, Text = addNewArticle.Text, URL = addNewArticle.Url }; await applicationDbContext.Articles.AddAsync(article); await applicationDbContext.SaveChangesAsync(); return RedirectToAction("ArticleIndex"); } return RedirectToAction("Index"); } }}using Microsoft.AspNetCore.Mvc;using System.Diagnostics;using WebAppHealthyEating.Models;namespace WebAppHealthyEating.Controllers{ public class HomeController : Controller { private readonlyILogger _logger; public HomeController(ILogger logger) { _logger = logger; } public IActionResultIndex() { return View(); } public IActionResultPrivacy() { return View(); } [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] public IActionResultError() { return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); } }}usingMicrosoft.AspNetCore.Identity;using System.ComponentModel.DataAnnotations;namespace WebAppHealthyEating.Data.Model{ public class Article { [Key] public Guid Id { get; set; } [Required(ErrorMessage = "The Title field is required.")] [StringLength(100, MinimumLength = 5, ErrorMessage = "The Title field must be between 5 and 100 characters.")] public string Title { get; set; } [Required(ErrorMessage = "The Sub Title field is required.")] [StringLength(100, MinimumLength = 5, ErrorMessage = "The Title field must be between 5 and 100 characters.")] public string SubTitle{ get; set; } = "Subtitle"; [Required(ErrorMessage = "The Author field is required.")] public string AuthorId{ get; set; } public IdentityUser Author { get; set; } [Required(ErrorMessage = "The PublicationDate field is required.")] [DataType(DataType.Date)] public DateTimePublicationDate{ get; set; } [Required(ErrorMessage = "The Text field is required.")] public string Text { get; set; } [Required(ErrorMessage = "The Text field is required.")] public string? URL { get; set; } }}using System;using System.ComponentModel.DataAnnotations;namespace WebAppHealthyEating.Data.Model{ [Index(nameof(UserName), IsUnique = true)] public class User :IdentityUser { [Key] public Guid Id { get; set; } [Required(ErrorMessage = "The Author field is required.")] [StringLength(50, MinimumLength = 5, ErrorMessage = "The UserName field must be between 5 and 50 characters.")] public string UserName{ get; set; } [Required] [StringLength(100, MinimumLength = 5, ErrorMessage = "The Email field must be between 5 and 100 characters.")] public string Email { get; set; } [Required] [StringLength(50, MinimumLength = 5, ErrorMessage = "The Password field must be between 5 and 50 characters.")] public string Password { get; set; } public bool EmailConfirmed{ get; set; } = false; public bool RootStat{ get; set; } = false; }}using Microsoft.AspNetCore.Identity;using Microsoft.AspNetCore.Identity.EntityFrameworkCore;using Microsoft.EntityFrameworkCore;using WebAppHealthyEating.Data.Model;namespace WebAppHealthyEating.Data{ public class ApplicationDbContext :IdentityDbContext { public ApplicationDbContext(DbContextOptions options) : base(options) { } public DbSet Users { get; set; } public DbSet Articles { get; set; }}}ПРИЛОЖЕНИЕБ @ViewData["Title"] - WebAppHealthyEating <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" /> <link rel="stylesheet" href="~/css/site.css" asp-append-version="true" /> <link rel="subresource" href="~/img" asp-append-version="true" /> @* <link rel="stylesheet" href="~/css/style.css" asp-append-version="true" />*@ <link rel="stylesheet" href="~/WebAppHealthyEating.styles.css" asp-append-version="true" />
CПИСОК ИСПОЛЬЗОВАННЫХ ИСТОЧНИКОВ 1. Дино Эспозито. Microsoft ASP.NET 2.0. Базовый курс. — СПб.: И. Д. Питер, 2007. — 688 с. — ISBN 978-5-91180-423-7. — ISBN 978-5-7502-0304-8. 2. Платт Д. С. Знакомство с Microsoft .NET. — М.: И. Д. Русская редакция, 2001. — 240 с. — ISBN 5-7502-0186-4. 3. Architecture Journal Profile: Scott Guthrie). The Architecture Journal. Microsoft (январь 2007). . 4. Michiel van Otegem. Interview with Scott Guthrie, creator of ASP.NET 5. Tim Anderson. How ASP.NET began in Java The Register (2018 года). 6. ASP.NET Web Pages (Razor) FAQ - docs.microsoft.com. 7. Get Started with ASP.NET Web API 2 (C#) docs.microsoft.com. 8. Мак-Дональд Мэтью, Фримен Адам, Шпушта Марио. Microsoft ASP.NET 4 с примерами на C# 2010 для профессионалов. — 4-е изд.. — М.: ООО "И.Д. Вильямс", 2011. — 1424 с. — ISBN 978-5-8459-1702-7. — ISBN 978-1-43-022529-4. 9. Laurence Moroney, Matthew MacDonald. Pro ASP.NET 2.0 in VB 2005. — Apress, 2006. — 1296 с. — ISBN 978-1-59059-563-3.