diff --git a/MyWebsite/.editorconfig b/MyWebsite/.editorconfig deleted file mode 100644 index 814ea3c..0000000 --- a/MyWebsite/.editorconfig +++ /dev/null @@ -1,4 +0,0 @@ -[*.cs] - -# CA1303: Do not pass literals as localized parameters -dotnet_diagnostic.CA1303.severity = none diff --git a/MyWebsite/MyWebsite/Areas/API/FoxTubeController.cs b/MyWebsite/MyWebsite/Areas/API/FoxTubeController.cs index eece78c..4cc4082 100644 --- a/MyWebsite/MyWebsite/Areas/API/FoxTubeController.cs +++ b/MyWebsite/MyWebsite/Areas/API/FoxTubeController.cs @@ -7,38 +7,38 @@ using MyWebsite.Models.Databases; namespace MyWebsite.Areas.API { - [ApiController] - [Route("API/[controller]")] - public class FoxTubeController : ControllerBase - { - readonly FoxTubeDatabaseContext db; - public FoxTubeController(FoxTubeDatabaseContext context) => - db = context; + [ApiController] + [Route("API/[controller]")] + public class FoxTubeController : ControllerBase + { + readonly FoxTubeDatabaseContext db; + public FoxTubeController(FoxTubeDatabaseContext context) => + db = context; - [HttpPost] - [Route("AddMetrics")] - public IActionResult AddMetrics(MetricsPackage package) - { - Guid id = db.Metrics.Add(package).Entity.Id; - db.SaveChanges(); + [HttpPost] + [Route("AddMetrics")] + public IActionResult AddMetrics(MetricsPackage package) + { + Guid id = db.Metrics.Add(package).Entity.Id; + db.SaveChanges(); - return Accepted(value: id.ToString()); - } + return Accepted(value: id.ToString()); + } - [HttpGet] - [Route("Messages")] - public IActionResult Messages(bool toast = false, DateTime? publishedAfter = null, string lang = "en-US") - { - if (toast) - { - Message message = publishedAfter.HasValue ? - db.Messages.FirstOrDefault(i => i.PublishedAt >= publishedAfter && i.PublishedAt <= DateTime.Now && i.Language == lang) : - db.Messages.OrderByDescending(i => i.PublishedAt).FirstOrDefault(); + [HttpGet] + [Route("Messages")] + public IActionResult Messages(bool toast = false, DateTime? publishedAfter = null, string lang = "en-US") + { + if (toast) + { + Message message = publishedAfter.HasValue ? + db.Messages.FirstOrDefault(i => i.PublishedAt >= publishedAfter && i.PublishedAt <= DateTime.Now && i.Language == lang) : + db.Messages.OrderByDescending(i => i.PublishedAt).FirstOrDefault(); - if (message == null) - return NoContent(); + if (message == null) + return NoContent(); - return Ok($@" + return Ok($@" @@ -48,22 +48,22 @@ namespace MyWebsite.Areas.API "); - } - else - return Ok(db.Messages.Where(i => i.PublishedAt <= DateTime.Now).ToList()); - } + } + else + return Ok(db.Messages.Where(i => i.PublishedAt <= DateTime.Now).ToList()); + } - [HttpGet] - [Route("Changelogs")] - public IActionResult Changelogs(string version, bool toast = false, string lang = "en-US") - { - if (toast) - { - Changelog changelog = db.Changelogs.FirstOrDefault(i => i.Version == version && i.Language == lang); - if (changelog == null) - return NoContent(); + [HttpGet] + [Route("Changelogs")] + public IActionResult Changelogs(string version, bool toast = false, string lang = "en-US") + { + if (toast) + { + Changelog changelog = db.Changelogs.FirstOrDefault(i => i.Version == version && i.Language == lang); + if (changelog == null) + return NoContent(); - return Ok($@" + return Ok($@" @@ -73,17 +73,17 @@ namespace MyWebsite.Areas.API "); - } - else - return Ok(db.Changelogs.Where(i => !IsVersionGreater(i.Version, version)).ToList()); - } + } + else + return Ok(db.Changelogs.Where(i => !IsVersionGreater(i.Version, version)).ToList()); + } - private static bool IsVersionGreater(string versionOne, string versionTwo) - { - versionOne = versionOne.Replace(".", "", StringComparison.InvariantCulture); - versionTwo = versionTwo.Replace(".", "", StringComparison.InvariantCulture); + private static bool IsVersionGreater(string versionOne, string versionTwo) + { + versionOne = versionOne.Replace(".", "", StringComparison.InvariantCulture); + versionTwo = versionTwo.Replace(".", "", StringComparison.InvariantCulture); - return short.Parse(versionOne, NumberStyles.Integer, CultureInfo.InvariantCulture) > short.Parse(versionTwo, NumberStyles.Integer, CultureInfo.InvariantCulture); - } - } + return short.Parse(versionOne, NumberStyles.Integer, CultureInfo.InvariantCulture) > short.Parse(versionTwo, NumberStyles.Integer, CultureInfo.InvariantCulture); + } + } } \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/API/GUTScheduleController.cs b/MyWebsite/MyWebsite/Areas/API/GUTScheduleController.cs index 0ff785b..a3164c7 100644 --- a/MyWebsite/MyWebsite/Areas/API/GUTScheduleController.cs +++ b/MyWebsite/MyWebsite/Areas/API/GUTScheduleController.cs @@ -1,6 +1,7 @@ using Microsoft.AspNetCore.Mvc; using MyWebsite.Controllers; using MyWebsite.Models.Databases; +using System.Linq; namespace MyWebsite.Areas.API { @@ -8,10 +9,12 @@ namespace MyWebsite.Areas.API [Route("API/[controller]")] public class GUTScheduleController : ExtendedController { - public GUTScheduleController(DatabaseContext context) : base(context) { } + GUTScheduleDatabaseContext databaseContext; + public GUTScheduleController(DatabaseContext context, GUTScheduleDatabaseContext db) : base(context) => + databaseContext = db; [Route("SemesterOffsetDay")] public string SemesterOffsetDay() => - Database.CustomData.Find("gut.schedule.semester.offset")?.Value ?? "undefined"; + databaseContext.OffsetDates?.FirstOrDefault()?.Value ?? "undefined"; } } \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Controllers/BadgesController.cs b/MyWebsite/MyWebsite/Areas/Admin/Controllers/BadgesController.cs index 30b33cd..da64573 100644 --- a/MyWebsite/MyWebsite/Areas/Admin/Controllers/BadgesController.cs +++ b/MyWebsite/MyWebsite/Areas/Admin/Controllers/BadgesController.cs @@ -7,87 +7,116 @@ using MyWebsite.Models.Databases; using System; using System.Globalization; using System.IO; +using System.Linq; namespace MyWebsite.Areas.Admin.Controllers { - [Area("Admin")] - [Authorize] - public class BadgesController : ExtendedController - { - public BadgesController(DatabaseContext context) : base(context) { } + [Area("Admin")] + [Authorize] + public class BadgesController : ExtendedController + { + public BadgesController(DatabaseContext context) : base(context) { } - public IActionResult Index() => - View(Database.Badges); + [HttpGet] + public IActionResult Index() => + View(Database.Badges); - [HttpGet] - public IActionResult Edit(string id) => - View(Database.Badges.Find(id)); + [HttpPost] + public IActionResult Index(IFormFile badgeImage) + { + if (badgeImage == null) + throw new ArgumentNullException(nameof(badgeImage)); - [HttpPost] - public IActionResult Edit(BadgeModel model, IFormFile file = null) - { - if (model == null) - throw new ArgumentNullException(nameof(model)); + System.Drawing.Image image = System.Drawing.Image.FromStream(badgeImage.OpenReadStream()); + if (System.IO.File.Exists(Directory.GetCurrentDirectory() + "/wwwroot/images/Badges/" + badgeImage.FileName)) + ModelState.AddModelError("Error", $"Badge image with such name ({badgeImage.FileName}) is already esists"); + else if (image.Width != 64 || image.Height != 64 || !badgeImage.FileName.EndsWith(".PNG", true, CultureInfo.InvariantCulture)) + ModelState.AddModelError("Error", "The file must be EXACTLY 64x64 pixels PNG image"); + else + using (var stream = System.IO.File.Create(Directory.GetCurrentDirectory() + "/wwwroot/images/Badges/" + badgeImage.FileName)) + badgeImage.CopyTo(stream); - if (file != null) - UploadFile(file, model); + return View(Database.Badges); + } - Database.Badges.Update(model); - Database.SaveChanges(); + [HttpGet] + public IActionResult Edit(string id) => + View(Database.Badges.Find(id)); - return RedirectToAction("Index"); - } + [HttpPost] + public IActionResult Edit(BadgeModel model) + { + if (model == null) + throw new ArgumentNullException(nameof(model)); - [HttpGet] - public IActionResult Delete(string id) => - View(Database.Badges.Find(id)); + if (!ModelState.IsValid) + { + ModelState.AddModelError("Error", "Invalid data"); + return View(model); + } - [HttpPost] - public IActionResult Delete(BadgeModel model) - { - Database.Badges.Remove(model); - Database.SaveChanges(); + Database.Badges.Update(model); + Database.SaveChanges(); - return RedirectToAction("Index"); - } + return RedirectToAction("Index"); + } - [HttpGet] - public IActionResult Create() => - View(); + [HttpGet] + public IActionResult Delete(string id) => + View(Database.Badges.Find(id)); - [HttpPost] - public IActionResult Create(BadgeModel model, IFormFile file = null) - { - if (model == null) - throw new ArgumentNullException(nameof(model)); + [HttpPost] + public IActionResult Delete(BadgeModel model) + { + if (Database.Projects.ToList().Any(i => i.Badges.Contains(model.Name, StringComparison.InvariantCulture))) + { + ModelState.Clear(); + ModelState.AddModelError("Error", "Remove badge references from projects descriptions in order to delete the badge"); + return View(Database.Badges.Find(model?.Name)); + } - if (file != null) - return UploadFile(file, model); + Database.Badges.Remove(model); + Database.SaveChanges(); - if (!ModelState.IsValid) - { - ModelState.AddModelError("Error", "Invalid data"); - return View(model); - } + return RedirectToAction("Index"); + } - Database.Badges.Add(model); - Database.SaveChanges(); + [HttpGet] + public IActionResult Create() => + View(model: null); - return RedirectToAction("Index"); - } + [HttpPost] + public IActionResult Create(BadgeModel model) + { + if (model == null) + throw new ArgumentNullException(nameof(model)); - private IActionResult UploadFile(IFormFile file, BadgeModel model) - { - System.Drawing.Image image = System.Drawing.Image.FromStream(file.OpenReadStream()); - if (image.Width != 64 || image.Height != 64 || !file.FileName.EndsWith(".PNG", true, CultureInfo.InvariantCulture)) - { - ViewData["UploadException"] = "error"; - return View(model); - } - using (var stream = System.IO.File.Create(Directory.GetCurrentDirectory() + "/wwwroot/images/Badges/" + file.FileName)) - file.CopyTo(stream); + if (!ModelState.IsValid) + { + ModelState.AddModelError("Error", "Invalid data"); + return View(model); + } - return Redirect(Request.Path.Value); - } - } + if (Database.Badges.Any(i => i.Name == model.Name)) + { + ModelState.AddModelError("Error", $"Badge '{model.Name}' is already exists"); + return View(model); + } + + Database.Badges.Add(model); + Database.SaveChanges(); + + return RedirectToAction("Index"); + } + + [HttpGet] + public IActionResult DeleteBadgeImage(string id) + { + string path = Directory.GetCurrentDirectory() + "/wwwroot/images/Badges/" + id; + if (System.IO.File.Exists(path)) + System.IO.File.Delete(path); + + return RedirectToAction("Index"); + } + } } \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Controllers/ContactsController.cs b/MyWebsite/MyWebsite/Areas/Admin/Controllers/ContactsController.cs index 93e12ff..64e5cff 100644 --- a/MyWebsite/MyWebsite/Areas/Admin/Controllers/ContactsController.cs +++ b/MyWebsite/MyWebsite/Areas/Admin/Controllers/ContactsController.cs @@ -3,61 +3,99 @@ using Microsoft.AspNetCore.Mvc; using MyWebsite.Controllers; using MyWebsite.Models; using MyWebsite.Models.Databases; +using System; +using System.Linq; namespace MyWebsite.Areas.Admin.Controllers { - [Area("Admin")] - [Authorize] - public class ContactsController : ExtendedController - { - public ContactsController(DatabaseContext context) : base(context) { } + [Area("Admin")] + [Authorize] + public class ContactsController : ExtendedController + { + public ContactsController(DatabaseContext context) : base(context) { } - public IActionResult Index() => - View(Database.Links); + public IActionResult Index() => + View(Database.Links); - [HttpGet] - public IActionResult Edit(string id) => - View(Database.Links.Find(id)); + [HttpPost] + public IActionResult Index(string[] reorderList) + { + if(reorderList?.Length != Database.Links.Count()) + { + ModelState.AddModelError("Error", "Invalid or incomplete data recieved"); + return View(Database.Links); + } - [HttpPost] - public IActionResult Edit(LinkModel model) - { - Database.Links.Update(model); - Database.SaveChanges(); + for (int i = 0; i < reorderList.Length; i++) + Database.Links.Find(reorderList[i]).Order = i; + + Database.SaveChanges(); - return RedirectToAction("Index"); - } + return View(Database.Links); + } - [HttpGet] - public IActionResult Delete(string id) => - View(Database.Links.Find(id)); + [HttpGet] + public IActionResult Edit(string id) => + View(Database.Links.Find(id)); - [HttpPost] - public IActionResult Delete(LinkModel model) - { - Database.Links.Remove(model); - Database.SaveChanges(); + [HttpPost] + public IActionResult Edit(LinkModel model) + { + if (model == null) + throw new ArgumentNullException(nameof(model)); - return RedirectToAction("Index"); - } + if (!ModelState.IsValid) + { + ModelState.AddModelError("Error", "Invalid data"); + return View(model); + } - [HttpGet] - public IActionResult Create() => - View(); + Database.Links.Update(model); + Database.SaveChanges(); - [HttpPost] - public IActionResult Create(LinkModel model) - { - if (!ModelState.IsValid) - { - ModelState.AddModelError("Error", "Invalid data"); - return View(model); - } + return RedirectToAction("Index"); + } - Database.Links.Add(model); - Database.SaveChanges(); + [HttpGet] + public IActionResult Delete(string id) => + View(Database.Links.Find(id)); - return RedirectToAction("Index"); - } - } + [HttpPost] + public IActionResult Delete(LinkModel model) + { + Database.Links.Remove(model); + Database.SaveChanges(); + + return RedirectToAction("Index"); + } + + [HttpGet] + public IActionResult Create() => + View(model: null); + + [HttpPost] + public IActionResult Create(LinkModel model) + { + if (model == null) + throw new ArgumentNullException(nameof(model)); + + if (!ModelState.IsValid) + { + ModelState.AddModelError("Error", "Invalid data"); + return View(model); + } + model.Order = Database.Links.Count(); + + if (Database.Links.Any(i => i.Name == model.Name)) + { + ModelState.AddModelError("Error", $"Link '{model.Name}' is already exists"); + return View(model); + } + + Database.Links.Add(model); + Database.SaveChanges(); + + return RedirectToAction("Index"); + } + } } \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Controllers/CredentialController.cs b/MyWebsite/MyWebsite/Areas/Admin/Controllers/CredentialController.cs index f29d5a5..59bc950 100644 --- a/MyWebsite/MyWebsite/Areas/Admin/Controllers/CredentialController.cs +++ b/MyWebsite/MyWebsite/Areas/Admin/Controllers/CredentialController.cs @@ -2,51 +2,68 @@ using Microsoft.AspNetCore.Mvc; using MyWebsite.Controllers; using MyWebsite.Helpers; +using MyWebsite.Models; using MyWebsite.Models.Databases; using System.Linq; namespace MyWebsite.Areas.Admin.Controllers { - [Area("Admin")] - [Authorize] - public class CredentialController : ExtendedController - { - const string viewPath = "Areas/Admin/Views/Shared/Credential.cshtml"; + [Area("Admin")] + [Authorize] + public class CredentialController : ExtendedController + { + const string viewPath = "Areas/Admin/Views/Shared/Credential.cshtml"; - public CredentialController(DatabaseContext context) : base(context) { } + public CredentialController(DatabaseContext context) : base(context) { } - [HttpGet] - public IActionResult Index() => - View(viewPath); + [HttpGet] + public IActionResult Index() => + View(viewPath); - [HttpPost] - public IActionResult Index(Models.CredentialModel model) - { - MyWebsite.Models.CredentialModel credential = Database.Users.FirstOrDefault(); + [HttpPost] + public IActionResult Index(string key, string value) + { + if(string.IsNullOrWhiteSpace(key)) + { + ModelState.AddModelError("Validation error", "Unable to identify data to update"); + return View(viewPath); + } - if (model == null || model.Current.Email != credential.Email || !Encryptor.VerifyHash(model.Current.Password, credential.Password)) - { - ModelState.AddModelError("Authorization error", "Invaild e-mail or password"); - return View(viewPath, model); - } + if(string.IsNullOrWhiteSpace(value)) + { + ModelState.AddModelError("Validation error", "No data provided"); + return View(viewPath); + } - if(string.IsNullOrWhiteSpace(model.Updated.Email) && string.IsNullOrWhiteSpace(model.Current.Password)) - { - ModelState.AddModelError("Validation error", "No data to update"); - return View(viewPath, model); - } + CredentialModel credential = Database.Users.FirstOrDefault(); + Database.Users.RemoveRange(Database.Users); - Database.Users.Remove(credential); - Database.SaveChanges(); - if(!string.IsNullOrWhiteSpace(model.Current.Email)) - credential.Email = model.Updated.Email; - if(!string.IsNullOrWhiteSpace(model.Current.Password)) - credential.Password = Encryptor.ComputeHash(model.Updated.Password); - Database.Users.Add(credential); + switch (key) + { + case "password": + Database.Users.Add(new CredentialModel + { + Email = credential.Email, + Password = Encryptor.ComputeHash(value) + }); + break; - Database.SaveChanges(); + case "email": + Database.Users.Add(new CredentialModel + { + Email = value, + Password = credential.Password + }); + break; - return Redirect("~/Admin/Logout"); - } - } + default: + ModelState.AddModelError("Processing error", "Provided data is missing or read-only"); + return View(viewPath); + } + + Database.SaveChanges(); + + return Redirect("~/Admin/Logout"); + } + } } \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Controllers/FoxTubeController.cs b/MyWebsite/MyWebsite/Areas/Admin/Controllers/FoxTubeController.cs new file mode 100644 index 0000000..ca26173 --- /dev/null +++ b/MyWebsite/MyWebsite/Areas/Admin/Controllers/FoxTubeController.cs @@ -0,0 +1,20 @@ +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; + +namespace MyWebsite.Areas.Admin.Controllers +{ + [Area("Admin")] + [Authorize] + public class FoxTubeController : Controller + { + public IActionResult Index() + { + return View(); + } + + public IActionResult Screenshots() + { + return View(); + } + } +} \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Controllers/GUTScheduleController.cs b/MyWebsite/MyWebsite/Areas/Admin/Controllers/GUTScheduleController.cs index f482489..b7ec8e6 100644 --- a/MyWebsite/MyWebsite/Areas/Admin/Controllers/GUTScheduleController.cs +++ b/MyWebsite/MyWebsite/Areas/Admin/Controllers/GUTScheduleController.cs @@ -4,38 +4,130 @@ using MyWebsite.Controllers; using MyWebsite.Models; using MyWebsite.Models.Databases; using System.Linq; +using System; +using MyWebsite.ViewModels; +using System.Globalization; namespace MyWebsite.Areas.Admin.Controllers { - [Authorize] - [Area("Admin")] - public class GUTScheduleController : ExtendedController - { - const string scheduleOffsetId = "gut.schedule.semester.offset"; - const string viewPath = "Areas/Admin/Views/Shared/GUTSchedule.cshtml"; + [Authorize] + [Area("Admin")] + public class GUTScheduleController : ExtendedController + { + const string viewPath = "Areas/Admin/Views/Shared/GUTSchedule.cshtml"; - public GUTScheduleController(DatabaseContext context) : base(context) { } + private GUTScheduleDatabaseContext db; - [HttpGet] - public IActionResult Index() => - View(viewPath, Database.CustomData.Find(scheduleOffsetId) ?? new CustomData { Key = scheduleOffsetId, Value = "undefined" }); + public GUTScheduleController(DatabaseContext context, GUTScheduleDatabaseContext databaseContext) : base(context) => + db = databaseContext; - [HttpPost] - public IActionResult Index(CustomData model) - { - if(!ModelState.IsValid) - { - ModelState.AddModelError("Error", "Invalid data"); - return View(model); - } + [HttpGet] + public IActionResult Index() + { + ViewData["Policies"] = db.PrivacyPolicies; + return View(viewPath, db.OffsetDates.FirstOrDefault()); + } - if(Database.CustomData.Any(i => i.Key == scheduleOffsetId)) - Database.CustomData.Update(model); - else - Database.CustomData.Add(model); - Database.SaveChanges(); - return View(viewPath, model); - } - } + [HttpPost] + public IActionResult Index(CustomData model) + { + if (model == null) + throw new ArgumentNullException(nameof(model)); + + if (!ModelState.IsValid) + { + ModelState.AddModelError("Error", "Invalid data"); + return View(model); + } + + db.OffsetDates.RemoveRange(db.OffsetDates); + db.OffsetDates.Add(model); + + db.SaveChanges(); + + return Index(); + } + + [HttpGet] + public IActionResult CreatePolicy() + { + ViewData["Caption"] = "privacy policy"; + return View(viewName: "Areas/Admin/Views/Resume/Create.cshtml"); + } + + [HttpPost] + public IActionResult CreatePolicy(ResumeModel model) + { + if (model == null) + throw new ArgumentNullException(nameof(model)); + + if (!ModelState.IsValid) + { + ModelState.AddModelError("Error", "Invalid data"); + return View("Areas/Admin/Views/Resume/Create.cshtml", model); + } + + model.LastUpdate = DateTime.Now; + + if (db.PrivacyPolicies.Any(i => i.Language == model.Language)) + { + ModelState.AddModelError("Error", $"Resume with this language ({model.Language}) is already exists"); + return View("Areas/Admin/Views/Resume/Create.cshtml", model); + } + + db.PrivacyPolicies.Add(model); + db.SaveChanges(); + + return RedirectToAction("Index"); + } + + [HttpGet] + public IActionResult DeletePolicy(string id) + { + ViewData["Caption"] = "privacy policy"; + return View("Areas/Admin/Views/Resume/Delete.cshtml", db.PrivacyPolicies.Find(id)); + } + + [HttpPost] + public IActionResult DeletePolicy(ResumeModel model) + { + db.PrivacyPolicies.Remove(model); + db.SaveChanges(); + + return RedirectToAction("Index"); + } + + [HttpGet] + public IActionResult EditPolicy(string id) + { + ViewData["Caption"] = "privacy policy"; + return View("Areas/Admin/Views/Resume/Edit.cshtml", db.PrivacyPolicies.Find(id)); + } + + [HttpPost] + public IActionResult EditPolicy(ResumeModel model) + { + if (model == null) + throw new ArgumentNullException(nameof(model)); + + if (!ModelState.IsValid) + { + ModelState.AddModelError("Error", "Invalid data"); + return View("Areas/Admin/Views/Resume/Edit.cshtml", model); + } + + model.LastUpdate = DateTime.Now; + + db.PrivacyPolicies.Update(model); + db.SaveChanges(); + + return RedirectToAction("Index"); + } + + [AllowAnonymous] + [Route("/Projects/GUTSchedule/PrivacyPolicy")] + public IActionResult PrivacyPolicy() => + View("Areas/Projects/Views/GUTSchedule/PrivacyPolicy.cshtml", new ResumeViewModel(db.PrivacyPolicies.Find(CultureInfo.CurrentCulture.TwoLetterISOLanguageName) ?? db.PrivacyPolicies.Find("en") ?? db.PrivacyPolicies.Find("ru"), Database)); + } } \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Controllers/GalleryController.cs b/MyWebsite/MyWebsite/Areas/Admin/Controllers/GalleryController.cs index cf0540e..d85faf2 100644 --- a/MyWebsite/MyWebsite/Areas/Admin/Controllers/GalleryController.cs +++ b/MyWebsite/MyWebsite/Areas/Admin/Controllers/GalleryController.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; -using MyWebsite.Areas.Admin.Models; using MyWebsite.Controllers; using MyWebsite.Models; using MyWebsite.Models.Databases; @@ -9,90 +9,77 @@ using System.IO; namespace MyWebsite.Areas.Admin.Controllers { - [Area("Admin")] - [Authorize] - public class GalleryController : ExtendedController - { - public GalleryController(DatabaseContext context) : base(context) { } + [Area("Admin")] + [Authorize] + public class GalleryController : ExtendedController + { + public GalleryController(DatabaseContext context) : base(context) { } - public IActionResult Index() => - View(Database.Gallery); + public IActionResult Index() => + View(Database.Gallery); - [HttpGet] - public IActionResult Edit(Guid id) - { - if (Database.Gallery.Find(id) is ImageModel model) - return View(model); - else - return NotFound(); - } + [HttpGet] + public IActionResult Edit(string id) => + View(Database.Gallery.Find(id)); - [HttpPost] - public IActionResult Edit(ImageModel model) - { - if (!ModelState.IsValid) - { - ModelState.AddModelError("Error", "Invalid data"); - return View(model); - } + [HttpPost] + public IActionResult Edit(ImageModel model) + { + if (!ModelState.IsValid) + { + ModelState.AddModelError("Error", "Invalid data"); + return View(model); + } - Database.Gallery.Update(model); - Database.SaveChanges(); + Database.Gallery.Update(model); + Database.SaveChanges(); - return RedirectToAction("Index"); - } + return RedirectToAction("Index"); + } - [HttpGet] - public IActionResult Delete(Guid id) - { - if (Database.Gallery.Find(id) is ImageModel model) - return View(model); - else - return NotFound(); - } + [HttpGet] + public IActionResult Delete(string id) => + View(Database.Gallery.Find(id)); - [HttpPost] - public IActionResult Delete(ImageModel model) - { - Database.Gallery.Remove(model); - Database.SaveChanges(); + [HttpPost] + public IActionResult Delete(ImageModel model) + { + Database.Gallery.Remove(model); + Database.SaveChanges(); - System.IO.File.SetAttributes(Directory.GetCurrentDirectory() + "/wwwroot/images/Gallery/" + model?.FileName, FileAttributes.Normal); - System.IO.File.Delete(Directory.GetCurrentDirectory() + "/wwwroot/images/Gallery/" + model?.FileName); + System.IO.File.SetAttributes(Directory.GetCurrentDirectory() + "/wwwroot/images/Gallery/" + model?.FileName, FileAttributes.Normal); + System.IO.File.Delete(Directory.GetCurrentDirectory() + "/wwwroot/images/Gallery/" + model?.FileName); - return RedirectToAction("Index"); - } + return RedirectToAction("Index"); + } - [HttpGet] - public IActionResult Upload() => - View(); + [HttpGet] + public IActionResult Upload() => + View(model: null); - [HttpPost] - public IActionResult Upload(ArtworkModel model) - { - if (!ModelState.IsValid) - { - ModelState.AddModelError("Error", "Invalid data"); - return View(model); - } + [HttpPost] + public IActionResult Upload(ImageModel model, IFormFile file) + { + if (model == null) + throw new ArgumentNullException(nameof(model)); + if (file == null) + throw new ArgumentNullException(nameof(file)); - using (var stream = System.IO.File.Create(Directory.GetCurrentDirectory() + "/wwwroot/images/Gallery/" + model?.File.FileName)) - model.File.CopyTo(stream); + model.FileName = file.FileName; - ImageModel image = new ImageModel - { - EnglishTitle = model.EnglishTitle, - RussianTitle = model.RussianTitle, - EnglishDescription = model.EnglishDescription, - RussianDescription = model.RussianDescription, - CreationDate = model.CreationDate, - FileName = model.File.FileName - }; + if (!ModelState.IsValid) + { + ModelState.AddModelError("Error", "Invalid data"); + return View(model); + } - Database.Gallery.Add(image); - Database.SaveChanges(); + using (var stream = System.IO.File.Create(Directory.GetCurrentDirectory() + "/wwwroot/images/Gallery/" + file.FileName)) + file.CopyTo(stream); - return RedirectToAction("Index"); - } - } + Database.Gallery.Add(model); + Database.SaveChanges(); + + return RedirectToAction("Index"); + } + } } \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Controllers/ProjectsController.cs b/MyWebsite/MyWebsite/Areas/Admin/Controllers/ProjectsController.cs index 43c3b11..c5d850d 100644 --- a/MyWebsite/MyWebsite/Areas/Admin/Controllers/ProjectsController.cs +++ b/MyWebsite/MyWebsite/Areas/Admin/Controllers/ProjectsController.cs @@ -1,4 +1,6 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; +using System.Linq; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using MyWebsite.Controllers; @@ -7,57 +9,98 @@ using MyWebsite.Models.Databases; namespace MyWebsite.Areas.Admin.Controllers { - [Area("Admin")] - [Authorize] - public class ProjectsController : ExtendedController - { - public ProjectsController(DatabaseContext context) : base(context) { } + [Area("Admin")] + [Authorize] + public class ProjectsController : ExtendedController + { + public ProjectsController(DatabaseContext context) : base(context) { } - public IActionResult Index() => - View((Database.Projects as IEnumerable, Database.Badges as IEnumerable)); + [HttpGet] + public IActionResult Index() => + View((Database.Projects as IEnumerable, Database.Badges as IEnumerable)); - [HttpGet] - public IActionResult Delete(decimal id) => - View(Database.Projects.Find(id)); + [HttpPost] + public IActionResult Index(Guid[] reorderList) + { + if (reorderList?.Length != Database.Projects.Count()) + ModelState.AddModelError("Error", "Invalid or incomplete data recieved"); + else + { + for (int i = 0; i < reorderList.Length; i++) + Database.Projects.Find(reorderList[i]).Order = i; - [HttpPost] - public IActionResult Delete(ProjectModel model) - { - Database.Projects.Remove(model); - Database.SaveChanges(); + Database.SaveChanges(); + } - return RedirectToAction("Index"); - } + return View((Database.Projects as IEnumerable, Database.Badges as IEnumerable)); + } - [HttpGet] - public IActionResult Create() => - View(); + [HttpGet] + public IActionResult Delete(Guid id) + { + ViewData["Badges"] = Database.Badges.ToList(); + return View(Database.Projects.Find(id)); + } - [HttpPost] - public IActionResult Create(ProjectModel model) - { - if (!ModelState.IsValid) - { - ModelState.AddModelError("Error", "Invalid data"); - return View(model); - } + [HttpPost] + public IActionResult Delete(ProjectModel model) + { + Database.Projects.Remove(model); + Database.SaveChanges(); - Database.Projects.Add(model); - Database.SaveChanges(); + return RedirectToAction("Index"); + } - return RedirectToAction("Index"); - } - } + [HttpGet] + public IActionResult Edit(Guid id) + { + ViewData["Badges"] = Database.Badges.ToList(); + return View(Database.Projects.Find(id)); + } - public class ProjectEditorModel - { - public double Id { get; set; } - public string EnglishTitle { get; set; } - public string RussianTitle { get; set; } - public string EnglishDescription { get; set; } - public string RussianDescription { get; set; } - public string Link { get; set; } - public string EnglishLinkCaption { get; set; } - public string RussianLinkCaption { get; set; } - } + [HttpPost] + public IActionResult Edit(ProjectModel model) + { + if (model == null) + throw new ArgumentNullException(nameof(model)); + + if (!ModelState.IsValid) + { + ModelState.AddModelError("Error", "Invalid data"); + ViewData["Badges"] = Database.Badges.ToList(); + return View(model); + } + + Database.Projects.Update(model); + Database.SaveChanges(); + + return RedirectToAction("Index"); + } + + [HttpGet] + public IActionResult Create() + { + ViewData["Badges"] = Database.Badges.ToList(); + return View(model: null); + } + + [HttpPost] + public IActionResult Create(ProjectModel model) + { + if (model == null) + throw new ArgumentNullException(nameof(model)); + + if (!ModelState.IsValid) + { + ModelState.AddModelError("Error", "Invalid data"); + return View(model); + } + model.Order = Database.Projects.Count(); + + Database.Projects.Add(model); + Database.SaveChanges(); + + return RedirectToAction("Index"); + } + } } \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Controllers/ResumeController.cs b/MyWebsite/MyWebsite/Areas/Admin/Controllers/ResumeController.cs index 5eaf949..c9f8317 100644 --- a/MyWebsite/MyWebsite/Areas/Admin/Controllers/ResumeController.cs +++ b/MyWebsite/MyWebsite/Areas/Admin/Controllers/ResumeController.cs @@ -4,77 +4,84 @@ using MyWebsite.Controllers; using MyWebsite.Models; using MyWebsite.Models.Databases; using System; +using System.Linq; namespace MyWebsite.Areas.Admin.Controllers { - [Authorize] - [Area("Admin")] - public class ResumeController : ExtendedController - { - public ResumeController(DatabaseContext context) : base(context) { } + [Authorize] + [Area("Admin")] + public class ResumeController : ExtendedController + { + public ResumeController(DatabaseContext context) : base(context) { } - public IActionResult Index() => - View(Database.Resume); + public IActionResult Index() => + View(Database.Resume); - [HttpGet] - public IActionResult Edit(string id) => - View(Database.Resume.Find(id)); + [HttpGet] + public IActionResult Edit(string id) => + View(Database.Resume.Find(id)); - [HttpPost] - public IActionResult Edit(ResumeModel model) - { - if (model == null) - throw new ArgumentNullException(nameof(model)); + [HttpPost] + public IActionResult Edit(ResumeModel model) + { + if (model == null) + throw new ArgumentNullException(nameof(model)); - if (!ModelState.IsValid) - { - ModelState.AddModelError("Error", "Invalid data"); - return View(model); - } + if (!ModelState.IsValid) + { + ModelState.AddModelError("Error", "Invalid data"); + return View(model); + } - model.LastUpdate = DateTime.Now; + model.LastUpdate = DateTime.Now; - Database.Resume.Update(model); - Database.SaveChanges(); + Database.Resume.Update(model); + Database.SaveChanges(); - return RedirectToAction("Index"); - } + return RedirectToAction("Index"); + } - [HttpGet] - public IActionResult Delete(string id) => - View(Database.Resume.Find(id)); + [HttpGet] + public IActionResult Delete(string id) => + View(Database.Resume.Find(id)); - [HttpPost] - public IActionResult Delete(ResumeModel model) - { - Database.Resume.Remove(model); - Database.SaveChanges(); + [HttpPost] + public IActionResult Delete(ResumeModel model) + { + Database.Resume.Remove(model); + Database.SaveChanges(); - return RedirectToAction("Index"); - } + return RedirectToAction("Index"); + } - [HttpGet] - public IActionResult Create() => - View(); + [HttpGet] + public IActionResult Create() => + (this as Controller).View(); - [HttpPost] - public IActionResult Create(ResumeModel model) - { - if (model == null) - throw new ArgumentNullException(nameof(model)); + [HttpPost] + public IActionResult Create(ResumeModel model) + { + if (model == null) + throw new ArgumentNullException(nameof(model)); - if (!ModelState.IsValid) - { - ModelState.AddModelError("Error", "Invalid data"); - return View(model); - } + if (!ModelState.IsValid) + { + ModelState.AddModelError("Error", "Invalid data"); + return View(model); + } - model.LastUpdate = DateTime.Now; + model.LastUpdate = DateTime.Now; - Database.Resume.Add(model); - Database.SaveChanges(); + if(Database.Resume.Any(i => i.Language == model.Language)) + { + ModelState.AddModelError("Error", $"Resume with this language ({model.Language}) is already exists"); + return View(model); + } - return RedirectToAction("Index"); - } - } + Database.Resume.Add(model); + Database.SaveChanges(); + + return RedirectToAction("Index"); + } + } } \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Models/ArtworkModel.cs b/MyWebsite/MyWebsite/Areas/Admin/Models/ArtworkModel.cs deleted file mode 100644 index e797671..0000000 --- a/MyWebsite/MyWebsite/Areas/Admin/Models/ArtworkModel.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.AspNetCore.Http; -using System; -using System.ComponentModel; -using System.ComponentModel.DataAnnotations; - -namespace MyWebsite.Areas.Admin.Models -{ - public class ArtworkModel - { - [Required] - [DisplayName("Title (en)")] - public string EnglishTitle { get; set; } - [DisplayName("Title (ru)")] - public string RussianTitle { get; set; } - - [Required] - [DisplayName("Description (en)")] - public string EnglishDescription { get; set; } - [DisplayName("Description (ru)")] - public string RussianDescription { get; set; } - - [Required] - [DisplayName("Created")] - public DateTime CreationDate { get; set; } - [Required] - [DisplayName("File")] - public IFormFile File { get; set; } - } -} diff --git a/MyWebsite/MyWebsite/Areas/Admin/Models/CredentialModel.cs b/MyWebsite/MyWebsite/Areas/Admin/Models/CredentialModel.cs deleted file mode 100644 index 1616de8..0000000 --- a/MyWebsite/MyWebsite/Areas/Admin/Models/CredentialModel.cs +++ /dev/null @@ -1,14 +0,0 @@ -using MyWebsite.Models; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace MyWebsite.Areas.Admin.Models -{ - public class CredentialModel - { - public MyWebsite.Models.CredentialModel Current { get; set; } = new MyWebsite.Models.CredentialModel(); - public MyWebsite.Models.CredentialModel Updated { get; set; } = new MyWebsite.Models.CredentialModel(); - } -} \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Models/ReorderModel.cs b/MyWebsite/MyWebsite/Areas/Admin/Models/ReorderModel.cs deleted file mode 100644 index 8af77d4..0000000 --- a/MyWebsite/MyWebsite/Areas/Admin/Models/ReorderModel.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace MyWebsite.Areas.Admin.Models -{ - public enum ReorderDirection { Up, Down } - public class ReorderModel - { - public string ItemId { get; set; } - public ReorderDirection Direction { get; set; } - } -} diff --git a/MyWebsite/MyWebsite/Areas/Admin/NewFile.txt b/MyWebsite/MyWebsite/Areas/Admin/NewFile.txt deleted file mode 100644 index e69de29..0000000 diff --git a/MyWebsite/MyWebsite/Areas/Admin/Views/Badges/Create.cshtml b/MyWebsite/MyWebsite/Areas/Admin/Views/Badges/Create.cshtml index a71224d..46e571b 100644 --- a/MyWebsite/MyWebsite/Areas/Admin/Views/Badges/Create.cshtml +++ b/MyWebsite/MyWebsite/Areas/Admin/Views/Badges/Create.cshtml @@ -1,57 +1,47 @@ @model MyWebsite.Models.BadgeModel -@using System.IO; @{ - ViewData["Title"] = "Create badge"; - List files = new List(); - foreach (string path in Directory.GetFiles(Directory.GetCurrentDirectory() + "/wwwroot/images/Badges")) - { - string fileName = System.IO.Path.GetFileNameWithoutExtension(path); - files.Add(new SelectListItem(fileName, fileName)); - } + ViewData["Title"] = "Create badge"; }
-

Back to the list

-

Create project badge

+  Back to the list +

Create project badge

-
-
-
- - - -
-
- - - -
-
- - - -
-
- -
- - .png -
- -
- + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ +
+ + .png +
+ +
+ - - -
-

Upload badge image

-
- - - -
-
- - \ No newline at end of file + + + \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Views/Badges/Delete.cshtml b/MyWebsite/MyWebsite/Areas/Admin/Views/Badges/Delete.cshtml index 254b613..eec1da6 100644 --- a/MyWebsite/MyWebsite/Areas/Admin/Views/Badges/Delete.cshtml +++ b/MyWebsite/MyWebsite/Areas/Admin/Views/Badges/Delete.cshtml @@ -1,37 +1,41 @@ @model MyWebsite.Models.BadgeModel @{ - ViewData["Title"] = "Delete badge"; + ViewData["Title"] = "Delete badge"; }
-

Back to the list

-

Delete project badge

-

Are you sure you want to delete this?

+  Back to the list +

Delete project badge

+

Are you sure you want to delete this?

-

- @Html.DisplayNameFor(model => model.Name): @Model.Name
- @Html.DisplayNameFor(model => model.EnglishDescription): @Model.EnglishDescription
- @Html.DisplayNameFor(model => model.RussianDescription): @Model.RussianDescription
- @Html.DisplayNameFor(model => model.Image): @(Model.Image).png
+

+

+ @Html.DisplayNameFor(model => model.Name): @Model.Name
+ @Html.DisplayNameFor(model => model.EnglishDescription): @Model.EnglishDescription
+ @Html.DisplayNameFor(model => model.RussianDescription): @Model.RussianDescription
+ @Html.DisplayNameFor(model => model.Image): @(Model.Image).png
- Preview: -

-

+ Preview: +
+

-
- - -
+
+ + +
- - \ No newline at end of file +@section Imports +{ + +} \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Views/Badges/Edit.cshtml b/MyWebsite/MyWebsite/Areas/Admin/Views/Badges/Edit.cshtml index b6925a8..95bb0c4 100644 --- a/MyWebsite/MyWebsite/Areas/Admin/Views/Badges/Edit.cshtml +++ b/MyWebsite/MyWebsite/Areas/Admin/Views/Badges/Edit.cshtml @@ -1,57 +1,47 @@ -@using System.IO; -@model MyWebsite.Models.BadgeModel +@model MyWebsite.Models.BadgeModel @{ - ViewData["Title"] = "Edit badge"; - List files = new List(); - foreach (string path in Directory.GetFiles(Directory.GetCurrentDirectory() + "/wwwroot/images/Badges")) - { - string fileName = System.IO.Path.GetFileNameWithoutExtension(path); - files.Add(new SelectListItem(fileName, fileName)); - } + ViewData["Title"] = "Edit badge"; }
-

Back to the list

-

Edit project badge

+  Back to the list +

Edit project badge

-
-
-
- - - -
-
- - - -
-
- - - -
-
- -
- - .png -
- -
- + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ +
+ + .png +
+ +
+ - - -
-

Upload badge image

-
- - - -
-
- - \ No newline at end of file + + + \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Views/Badges/Index.cshtml b/MyWebsite/MyWebsite/Areas/Admin/Views/Badges/Index.cshtml index e161387..e5621d5 100644 --- a/MyWebsite/MyWebsite/Areas/Admin/Views/Badges/Index.cshtml +++ b/MyWebsite/MyWebsite/Areas/Admin/Views/Badges/Index.cshtml @@ -1,62 +1,159 @@ @model IEnumerable @{ - ViewData["Title"] = "Badges list"; + ViewData["Title"] = "Badges list"; }
-

Back to main menu

-

Project badges list

-

- // + Create New -

+  Back to main menu +

Project badges list

+ // + Create New
- - - - - - - - - - - - - @foreach (var item in Model) - { - - - - - - - - - } - -
Preview - @Html.DisplayNameFor(model => model.Name) - - @Html.DisplayNameFor(model => model.EnglishDescription) - - @Html.DisplayNameFor(model => model.RussianDescription) - - @Html.DisplayNameFor(model => model.Image) -
-
-
@item.Name@item.EnglishDescription@item.RussianDescription@item.Image - Edit | - Delete -
+ + + + + + + + + + + + + @foreach (var item in Model) + { + + + + + + + + + } + +
Preview + @Html.DisplayNameFor(model => model.Name) + + @Html.DisplayNameFor(model => model.EnglishDescription) + + @Html.DisplayNameFor(model => model.RussianDescription) + + @Html.DisplayNameFor(model => model.Image) + Actions
+
+
@item.Name@item.EnglishDescription@item.RussianDescription@item.Image + Edit | + Delete +
- - \ No newline at end of file +
+
+

Badge image files

+
+ +
+

Upload new badge image

+
+
+ + + + Note: Image should be exactly 64x64 pixels PNG file + +
+ +
+ +

Available badge images

+ + + + + + + + + + @foreach (string path in System.IO.Directory.GetFiles(System.IO.Directory.GetCurrentDirectory() + "/wwwroot/images/Badges")) + { + string file = System.IO.Path.GetFileName(path); + + + + + + } + +
PreviewFile nameActions
+
+
@file + @if (Model.Any(i => i.Image + ".png" == file)) + { + No available actions + } + else + { + Delete + } +
+
+ + + +@section Imports +{ + + +} \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Views/Contacts/Create.cshtml b/MyWebsite/MyWebsite/Areas/Admin/Views/Contacts/Create.cshtml index 2fdcc9e..eafc61b 100644 --- a/MyWebsite/MyWebsite/Areas/Admin/Views/Contacts/Create.cshtml +++ b/MyWebsite/MyWebsite/Areas/Admin/Views/Contacts/Create.cshtml @@ -1,55 +1,52 @@ @model MyWebsite.Models.LinkModel - @{ - ViewData["Title"] = "Create link"; + ViewData["Title"] = "Create link"; }
-

Back to the list

-

Create link

+  Back to the list +

Create link

-
-
-
- - - -
-
- - - -
-
- - - -
-
- - - -
-
- - - -
-
- - - -
+ +
+ + +
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ +
+
+
+ + +
- -
- - - - -
-
- - \ No newline at end of file + + + \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Views/Contacts/Delete.cshtml b/MyWebsite/MyWebsite/Areas/Admin/Views/Contacts/Delete.cshtml index a456c30..572fab7 100644 --- a/MyWebsite/MyWebsite/Areas/Admin/Views/Contacts/Delete.cshtml +++ b/MyWebsite/MyWebsite/Areas/Admin/Views/Contacts/Delete.cshtml @@ -1,31 +1,28 @@ @model MyWebsite.Models.LinkModel - @{ - ViewData["Title"] = "Delete link"; + ViewData["Title"] = "Delete link"; }
-

Back to the list

-

Delete link

-

Are you sure you want to delete this?

+  Back to the list +

Delete link

+

Are you sure you want to delete this?

-

- @Html.DisplayNameFor(model => model.Name): @Model.Name
- @Html.DisplayNameFor(model => model.Order): @Model.Order
- @Html.DisplayNameFor(model => model.EnglishTitle): @Model.EnglishTitle
- @Html.DisplayNameFor(model => model.RussianTitle): @Model.RussianTitle
- @Html.DisplayNameFor(model => model.Username): @Model.Username
- @Html.DisplayNameFor(model => model.Url): @Model.Url
- @Html.DisplayNameFor(model => model.CanContactMe): @Html.DisplayFor(model => model.CanContactMe)
- @Html.DisplayNameFor(model => model.DisplayInFooter): @Html.DisplayFor(model => model.DisplayInFooter) -

+

+ @Html.DisplayNameFor(model => model.Name): @Model.Name
+ @Html.DisplayNameFor(model => model.Order): @Model.Order
+ @Html.DisplayNameFor(model => model.EnglishTitle): @Model.EnglishTitle
+ @Html.DisplayNameFor(model => model.RussianTitle): @Model.RussianTitle
+ @Html.DisplayNameFor(model => model.Username): @Model.Username
+ @Html.DisplayNameFor(model => model.Url): @Model.Url
+ @Html.DisplayNameFor(model => model.CanContactMe): @Html.DisplayFor(model => model.CanContactMe)
+ @Html.DisplayNameFor(model => model.DisplayInFooter): @Html.DisplayFor(model => model.DisplayInFooter) +

-
- - -
-
- - \ No newline at end of file +
+ + +
+ \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Views/Contacts/Edit.cshtml b/MyWebsite/MyWebsite/Areas/Admin/Views/Contacts/Edit.cshtml index df2189b..12a78dd 100644 --- a/MyWebsite/MyWebsite/Areas/Admin/Views/Contacts/Edit.cshtml +++ b/MyWebsite/MyWebsite/Areas/Admin/Views/Contacts/Edit.cshtml @@ -1,53 +1,50 @@ @model MyWebsite.Models.LinkModel @{ - ViewData["Title"] = "Edit link"; + ViewData["Title"] = "Edit link"; }
-

Back to the list

-

Edit link

+  Back to the list +

Edit link

-
-
-
- - -
-
- - - -
-
- - - -
-
- - - -
-
- - - -
-
- - - -
+ +
+ +
+ + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ +
+
+
+ + +
- -
- - - - -
-
- - \ No newline at end of file + + + \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Views/Contacts/Index.cshtml b/MyWebsite/MyWebsite/Areas/Admin/Views/Contacts/Index.cshtml index 13deb2a..406f691 100644 --- a/MyWebsite/MyWebsite/Areas/Admin/Views/Contacts/Index.cshtml +++ b/MyWebsite/MyWebsite/Areas/Admin/Views/Contacts/Index.cshtml @@ -1,75 +1,90 @@ @model IEnumerable @{ - ViewData["Title"] = "Links list"; + ViewData["Title"] = "Links list"; }
-

Back to main menu

-

Links list

-

- // + Create New -

+  Back to main menu +

Links list

+ // + Create New
- - - - - - - - - - - - - - - - @foreach (var item in Model.OrderBy(i => i.Order)) - { - - - - - - - - - - - - } - -
Reorder - @Html.DisplayNameFor(model => model.Name) - - @Html.DisplayNameFor(model => model.EnglishTitle) - - @Html.DisplayNameFor(model => model.RussianTitle) - - @Html.DisplayNameFor(model => model.Username) - - @Html.DisplayNameFor(model => model.Url) - - @Html.DisplayNameFor(model => model.CanContactMe) - - @Html.DisplayNameFor(model => model.DisplayInFooter) -
@item.Name@item.EnglishTitle@item.RussianTitle@item.Username@item.Url - @Html.DisplayFor(modelItem => item.CanContactMe) - - @Html.DisplayFor(modelItem => item.DisplayInFooter) - - Edit | - Delete -
+
+ + + + + + + + + + + + + + + @foreach (var item in Model.OrderBy(i => i.Order)) + { + + + + + + + + + + + } + +
+ @Html.DisplayNameFor(model => model.Name) + + @Html.DisplayNameFor(model => model.Title) + + @Html.DisplayNameFor(model => model.Username) + + @Html.DisplayNameFor(model => model.Url) + + @Html.DisplayNameFor(model => model.CanContactMe) + + @Html.DisplayNameFor(model => model.DisplayInFooter) + Actions
+
+
+ +
@item.Name + @item.EnglishTitle (en)
+ @(item.RussianTitle ?? "") (ru) +
@item.Username@item.Url + @Html.DisplayFor(modelItem => item.CanContactMe) + + @Html.DisplayFor(modelItem => item.DisplayInFooter) + + Edit | + Delete +
+ +
- - \ No newline at end of file +@section Imports +{ + + + +} \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Views/FoxTube/Index.cshtml b/MyWebsite/MyWebsite/Areas/Admin/Views/FoxTube/Index.cshtml new file mode 100644 index 0000000..c117d0f --- /dev/null +++ b/MyWebsite/MyWebsite/Areas/Admin/Views/FoxTube/Index.cshtml @@ -0,0 +1,18 @@ +@{ + ViewData["Title"] = "FoxTube"; +} + +
+

FoxTube Backend control panel

+
+ + \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Views/Gallery/Delete.cshtml b/MyWebsite/MyWebsite/Areas/Admin/Views/Gallery/Delete.cshtml index 24bb4cc..5f74b66 100644 --- a/MyWebsite/MyWebsite/Areas/Admin/Views/Gallery/Delete.cshtml +++ b/MyWebsite/MyWebsite/Areas/Admin/Views/Gallery/Delete.cshtml @@ -1,34 +1,61 @@ @model MyWebsite.Models.ImageModel @{ - ViewData["Title"] = "Delete artwork"; + ViewData["Title"] = "Delete artwork"; }
-

Back to the list

-

Delete artwork

-

Are you sure you want to delete this?

+  Back to the list +

Delete artwork

+

Are you sure you want to delete this?

- + -
-

- @Html.DisplayNameFor(model => model.Title): @Model.Title
- @Html.DisplayNameFor(model => model.CreationDate): @Model.CreationDate
- @Html.DisplayNameFor(model => model.FileName): @Model.FileName
-

+
+

+ @Html.DisplayNameFor(model => model.Title): @Model.Title
+ @Html.DisplayNameFor(model => model.CreationDate): @Model.CreationDate
+ @Html.DisplayNameFor(model => model.FileName): @Model.FileName
+

-

- @Html.DisplayNameFor(model => model.Description): @Html.Raw(Model.Description)
-

+

+ @Html.DisplayNameFor(model => model.Description): @Html.Raw(Model.Description)
+

-
- - -
-
+
+ + +
+
- - \ No newline at end of file +@section Imports +{ + + + + +} \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Views/Gallery/Edit.cshtml b/MyWebsite/MyWebsite/Areas/Admin/Views/Gallery/Edit.cshtml index 2addcc2..0ac605c 100644 --- a/MyWebsite/MyWebsite/Areas/Admin/Views/Gallery/Edit.cshtml +++ b/MyWebsite/MyWebsite/Areas/Admin/Views/Gallery/Edit.cshtml @@ -1,48 +1,97 @@ @model MyWebsite.Models.ImageModel @{ - ViewData["Title"] = "Edit artwork"; + ViewData["Title"] = "Edit artwork"; }
-

-  Back to the list
-

Edit artwork

- // Open artwork -

+  Back to the list +

Edit artwork

+ // Open artwork file
-
-
- -
- - - -
-
- - - -
-
- - - -
-
- - - -
-
- - - -
+ - -
+
+
+ +
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+ + +
- \ No newline at end of file +@section Imports +{ + + + +} \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Views/Gallery/Index.cshtml b/MyWebsite/MyWebsite/Areas/Admin/Views/Gallery/Index.cshtml index 22b54d7..4b945e0 100644 --- a/MyWebsite/MyWebsite/Areas/Admin/Views/Gallery/Index.cshtml +++ b/MyWebsite/MyWebsite/Areas/Admin/Views/Gallery/Index.cshtml @@ -1,47 +1,53 @@ @model IEnumerable @{ - ViewData["Title"] = "Gallery"; + ViewData["Title"] = "Gallery"; }
-

Back to main menu

-

Gallery

-

- // + Upload new -

+  Back to main menu +

Gallery

+ //  Upload new
- - @foreach (ImageModel item in Model) - { - - - - - } -
- - -

-

@item.Title

- File name: @item.FileName
- Creation date: @item.CreationDate.ToShortDateString()
- - @Html.ActionLink("Edit", "Edit", new { id = item.FileName }) | - @Html.ActionLink("Delete", "Delete", new { id = item.FileName }) - -

-
+ + @foreach (ImageModel item in Model) + { + + + + + } +
+ + + + +

+

@item.Title

+ File name: @item.FileName
+ Creation date: @item.CreationDate.ToShortDateString()
+ + Edit | + Delete | + View + +

+
- - \ No newline at end of file +@section Imports +{ + +} \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Views/Gallery/Upload.cshtml b/MyWebsite/MyWebsite/Areas/Admin/Views/Gallery/Upload.cshtml index 72c9bfa..4a10e5f 100644 --- a/MyWebsite/MyWebsite/Areas/Admin/Views/Gallery/Upload.cshtml +++ b/MyWebsite/MyWebsite/Areas/Admin/Views/Gallery/Upload.cshtml @@ -1,49 +1,61 @@ -@model ArtworkModel +@model ImageModel @{ - ViewData["Title"] = "Upload artwork"; + ViewData["Title"] = "Upload artwork"; }
-

Back to the list

-

Upload an artwork

+  Back to the list +

Upload an artwork

-
-
-
- - - -
-
- - - -
-
- - - -
-
- - - -
-
- - - -
-
- - - -
+ +
+ + +
+
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
- -
+ +
- \ No newline at end of file +@section Imports +{ + +} \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Views/Projects/Create.cshtml b/MyWebsite/MyWebsite/Areas/Admin/Views/Projects/Create.cshtml index 3ea0b3a..343a34a 100644 --- a/MyWebsite/MyWebsite/Areas/Admin/Views/Projects/Create.cshtml +++ b/MyWebsite/MyWebsite/Areas/Admin/Views/Projects/Create.cshtml @@ -1,64 +1,107 @@ @model MyWebsite.Models.ProjectModel @{ - ViewData["Title"] = "New Project"; + ViewData["Title"] = "New Project"; }
-

Back to the list

-

Create new project

+

Back to the list

+

Create new project

-
-
-
- - - -
-
- - - -
-
- - - -
-
- - - -
-
- - - -
-
- - - -
-
- - - -
-
- - - -
-
- - - -
+ +
+ +
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+ @foreach (BadgeModel badge in ViewData["Badges"] as List) + { + +
+ @badge.Description
+ } +
+
- -
+ +
- \ No newline at end of file +@section Imports +{ + + + +} \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Views/Projects/Delete.cshtml b/MyWebsite/MyWebsite/Areas/Admin/Views/Projects/Delete.cshtml index 6005a6e..2017c33 100644 --- a/MyWebsite/MyWebsite/Areas/Admin/Views/Projects/Delete.cshtml +++ b/MyWebsite/MyWebsite/Areas/Admin/Views/Projects/Delete.cshtml @@ -1,31 +1,63 @@ @model MyWebsite.Models.ProjectModel @{ - ViewData["Title"] = "Delete project"; + ViewData["Title"] = "Delete project"; }
-

Back to the list

-

Delete project entry

-

Are you sure you want to delete this?

+  Back to the list +

Delete project entry

+

Are you sure you want to delete this?

-

- @Html.DisplayNameFor(model => model.Id): @Model.Id
- @Html.DisplayNameFor(model => model.EnglishTitle): @Model.EnglishTitle
- @Html.DisplayNameFor(model => model.RussianTitle): @Model.RussianTitle
- @Html.DisplayNameFor(model => model.EnglishDescription): @Model.EnglishDescription
- @Html.DisplayNameFor(model => model.RussianDescription): @Model.RussianDescription
- @Html.DisplayNameFor(model => model.Link): @Model.Link
- @Html.DisplayNameFor(model => model.EnglishLinkCaption): @Model.EnglishLinkCaption
- @Html.DisplayNameFor(model => model.RussianLinkCaption): @Model.RussianLinkCaption
- @Html.DisplayNameFor(model => model.Badges): @Model.Badges
-

+

+ @Html.DisplayNameFor(model => model.Id): @Model.Id
+

+

+ @Html.DisplayNameFor(model => model.EnglishTitle): @Model.EnglishTitle
+ @Html.DisplayNameFor(model => model.RussianTitle): @Model.RussianTitle
+

+

+ @Html.DisplayNameFor(model => model.EnglishLinkCaption): @Model.EnglishLinkCaption
+ @Html.DisplayNameFor(model => model.RussianLinkCaption): @Model.RussianLinkCaption
+

+

+ @Html.DisplayNameFor(model => model.Link): @Model.Link
+

+

+ @Html.DisplayNameFor(model => model.Badges): @Model.Badges
+

+ @foreach (string b in Model.Badges.Split(',')) + { + BadgeModel badge = (ViewData["Badges"] as List).FirstOrDefault(i => i.Name == b); +
+ } +
+

-
- - -
+
+ + +
- \ No newline at end of file +@section Imports +{ + +} \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Views/Projects/Edit.cshtml b/MyWebsite/MyWebsite/Areas/Admin/Views/Projects/Edit.cshtml new file mode 100644 index 0000000..f37539c --- /dev/null +++ b/MyWebsite/MyWebsite/Areas/Admin/Views/Projects/Edit.cshtml @@ -0,0 +1,111 @@ +@model MyWebsite.Models.ProjectModel +@{ + ViewData["Title"] = "Edit"; +} + +
+  Back to the list +

Edit project

+
+ +
+
+
+ +
+ + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+ @foreach (BadgeModel badge in ViewData["Badges"] as List) + { + +
+ @badge.Description
+ } +
+
+ + +
+
+ +@section Imports +{ + + + +} \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Views/Projects/Index.cshtml b/MyWebsite/MyWebsite/Areas/Admin/Views/Projects/Index.cshtml index ed8264d..7d13263 100644 --- a/MyWebsite/MyWebsite/Areas/Admin/Views/Projects/Index.cshtml +++ b/MyWebsite/MyWebsite/Areas/Admin/Views/Projects/Index.cshtml @@ -1,79 +1,110 @@ @model (IEnumerable projects, IEnumerable badges) @{ - ViewData["Title"] = "Projects"; + ViewData["Title"] = "Projects"; }
-

Back to main menu

-

Projects list

-

- // + Add New -

+  Back to main menu +

Projects list

+ // + Add new project
- - - - - - - - - - - - - @foreach (var item in Model.projects.OrderByDescending(i => i.Id)) - { - - - - - - - - - } - -
- @Html.DisplayNameFor(model => model.projects.First().Id) - - @Html.DisplayNameFor(model => model.projects.First().EnglishTitle) - - @Html.DisplayNameFor(model => model.projects.First().RussianTitle) - - @Html.DisplayNameFor(model => model.projects.First().Link) - - @Html.DisplayNameFor(model => model.projects.First().Badges) -
@item.Id@item.EnglishTitle@item.RussianTitle@item.Link -
- @foreach (string badge in item.Badges.Split(',')) - { -
i.Name == badge)?.Image + ".png")" title="@(Model.badges.FirstOrDefault(i => i.Name == badge)?.Description)">
- } -
-
- Edit | - Delete -
+
+ + + + + + + + + + + + + + @foreach (var item in Model.projects.OrderBy(i => i.Order)) + { + + + + + + + + + + } + +
+ @Html.DisplayNameFor(model => model.projects.First().Id) + + @Html.DisplayNameFor(model => model.projects.First().Title) + + @Html.DisplayNameFor(model => model.projects.First().LinkCaption) + + @Html.DisplayNameFor(model => model.projects.First().Link) + + @Html.DisplayNameFor(model => model.projects.First().Badges) + (Edit badges) + Actions
+
+
+ +
@item.Id + @item.EnglishTitle (en)
+ @(item.RussianTitle ?? "") (ru) +
+ @(item.EnglishLinkCaption ?? "") (en)
+ @(item.RussianLinkCaption ?? "") (ru) +
@item.Link +
+ @foreach (string b in item.Badges.Split(',')) + { + BadgeModel badge = Model.badges.FirstOrDefault(i => i.Name == b); +
+ } +
+
+ Edit | + Delete +
+ +
- - \ No newline at end of file + .badge-placeholder div + { + height: 25px; + width: 25px; + display: inline-block; + background-size: contain; + } + + .reorderingBtns + { + user-select: none; + } + + .reorderingBtns a:hover + { + cursor: pointer; + color: gray; + text-decoration: underline; + } + + + +} \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Views/Resume/Create.cshtml b/MyWebsite/MyWebsite/Areas/Admin/Views/Resume/Create.cshtml index c5eb8a9..0833580 100644 --- a/MyWebsite/MyWebsite/Areas/Admin/Views/Resume/Create.cshtml +++ b/MyWebsite/MyWebsite/Areas/Admin/Views/Resume/Create.cshtml @@ -1,39 +1,48 @@ @using System.Globalization @model MyWebsite.Models.ResumeModel @{ - ViewData["Title"] = "Create resume"; + ViewData["Title"] = "Create " + (ViewData["Caption"] ?? "resume"); }
-

Back to the list

-

Create resume

+  Back to the list +

Create @(ViewData["Caption"] ?? "resume")

-
-
-
- - - -
-
- - - -
-
- -
+
+
+
+ + + +
+
+ + + +
+
+ +
- - \ No newline at end of file + textarea + { + min-height: 500px; + } + +} \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Views/Resume/Delete.cshtml b/MyWebsite/MyWebsite/Areas/Admin/Views/Resume/Delete.cshtml index 348db35..e0832d5 100644 --- a/MyWebsite/MyWebsite/Areas/Admin/Views/Resume/Delete.cshtml +++ b/MyWebsite/MyWebsite/Areas/Admin/Views/Resume/Delete.cshtml @@ -1,24 +1,22 @@ @model MyWebsite.Models.ResumeModel @{ - ViewData["Title"] = "Delete resume"; + ViewData["Title"] = "Delete " + (ViewData["Caption"] ?? "resume"); }
-

Back to the list

-

Delete resume

-

Are you sure you want to delete this?

+  Back to the list +

Delete @(ViewData["Caption"] ?? "resume")

+

Are you sure you want to delete this?

-

- @Html.DisplayNameFor(model => model.Language): @(new System.Globalization.CultureInfo(Model.Language).DisplayName)
- @Html.DisplayNameFor(model => model.LastUpdate): @Model.LastUpdate
-

+

+ @Html.DisplayNameFor(model => model.Language): @(new System.Globalization.CultureInfo(Model.Language).DisplayName)
+ @Html.DisplayNameFor(model => model.LastUpdate): @Model.LastUpdate
+

-
- - -
-
- - \ No newline at end of file +
+ + +
+ \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Views/Resume/Edit.cshtml b/MyWebsite/MyWebsite/Areas/Admin/Views/Resume/Edit.cshtml index a4c23f5..cef1d98 100644 --- a/MyWebsite/MyWebsite/Areas/Admin/Views/Resume/Edit.cshtml +++ b/MyWebsite/MyWebsite/Areas/Admin/Views/Resume/Edit.cshtml @@ -1,50 +1,56 @@ @model MyWebsite.Models.ResumeModel - @{ - ViewData["Title"] = "Edit resume"; + ViewData["Title"] = "Edit " + (ViewData["Caption"] ?? "resume"); }
-

Back to the list

-

Edit resume

-

- Language: @(new System.Globalization.CultureInfo(Model.Language).DisplayName)
- Previously updated on @Model.LastUpdate -

+  Back to the list +

Edit @(ViewData["Caption"] ?? "resume")

+ Language: @(new System.Globalization.CultureInfo(Model.Language).DisplayName)
+ Previously updated on @Model.LastUpdate
+ + //  Copy to clipboard
- - - \ No newline at end of file +@section Imports +{ + + +} \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Views/Resume/Index.cshtml b/MyWebsite/MyWebsite/Areas/Admin/Views/Resume/Index.cshtml index cc19d2f..67082ed 100644 --- a/MyWebsite/MyWebsite/Areas/Admin/Views/Resume/Index.cshtml +++ b/MyWebsite/MyWebsite/Areas/Admin/Views/Resume/Index.cshtml @@ -1,44 +1,39 @@ @model IEnumerable - @{ - ViewData["Title"] = "Resumes"; + ViewData["Title"] = "Resumes"; }
-

Back to main menu

-

Resumes list

-

- // + Create New -

+  Back to main menu +

Resumes list

+ // + Create New
- - - - - - - - - - @foreach (var item in Model) - { - - - - - - } - -
- @Html.DisplayNameFor(model => model.Language) - - @Html.DisplayNameFor(model => model.LastUpdate) -
@item.Language@item.LastUpdate - Edit | - Delete -
-
- - \ No newline at end of file + + + + + + + + + + @foreach (var item in Model) + { + + + + + + } + +
+ @Html.DisplayNameFor(model => model.Language) + + @Html.DisplayNameFor(model => model.LastUpdate) + Actions
@item.Language@item.LastUpdate + Edit | + Delete +
+ \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Views/Shared/Credential.cshtml b/MyWebsite/MyWebsite/Areas/Admin/Views/Shared/Credential.cshtml index f34441e..aa24e86 100644 --- a/MyWebsite/MyWebsite/Areas/Admin/Views/Shared/Credential.cshtml +++ b/MyWebsite/MyWebsite/Areas/Admin/Views/Shared/Credential.cshtml @@ -1,69 +1,78 @@ -@model MyWebsite.Areas.Admin.Models.CredentialModel -@{ - ViewData["Title"] = "Edit credential"; +@{ + ViewData["Title"] = "Edit credential"; }
-

Back to main menu

-

Change credential information

+  Back to main menu +

Change credential information

-
-
-

- - -
- - -

-

- - -
- - -

-

- - -
- - - -

- -
+

Change e-mail

+
+
+ + + + + + + + + + +
+ +

Change password

+
+ + + + + + + + + + + +
- - \ No newline at end of file + function ValidatePassword() + { + var newPassword = document.querySelector("#newPassword"); + var confirmPassword = document.querySelector("#confirmPassword"); + + var passwordValidation = document.querySelector("#passwordValidationError"); + + passwordValidation.innerHTML = ""; + + if (newPassword.value == confirmPassword.value) + return true; + + passwordValidation.innerHTML = "Passwords doesn't match"; + return false; + } + +} \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Views/Shared/GUTSchedule.cshtml b/MyWebsite/MyWebsite/Areas/Admin/Views/Shared/GUTSchedule.cshtml index 2f9e041..276a98b 100644 --- a/MyWebsite/MyWebsite/Areas/Admin/Views/Shared/GUTSchedule.cshtml +++ b/MyWebsite/MyWebsite/Areas/Admin/Views/Shared/GUTSchedule.cshtml @@ -1,22 +1,49 @@ @model CustomData @{ ViewData["Title"] = "GUTSchedule"; + IEnumerable policies = ViewData["Policies"] as IEnumerable; }
-

Back to main menu

+  Back to main menu

GUTSchedule

+
+ +

Offset dates

-
- - + + - +
-
- \ No newline at end of file +

Privacy policies

+ // View privacy policy page
+ // + Add new privacy policy + + + + + + + + + + @foreach (ResumeModel item in policies) + { + + + + + + } + +
LangaugeLast updateActions
@item.Language@item.LastUpdate + Edit | + Delete +
+ \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Views/Shared/_Layout.cshtml b/MyWebsite/MyWebsite/Areas/Admin/Views/Shared/_Layout.cshtml new file mode 100644 index 0000000..6730eb9 --- /dev/null +++ b/MyWebsite/MyWebsite/Areas/Admin/Views/Shared/_Layout.cshtml @@ -0,0 +1,74 @@ + + + + @ViewData["Title"] - Admin pangel - XFox111.NET + + + + + + + + + + @RenderSection("Imports", false) + + @{ + if (IsSectionDefined("OpenGraph")) + RenderSection("OpenGraph"); + else + { + + + + + + + + + + + } + } + + + + + + + +
+ @RenderBody() +
+ +
+ // Copyright ©@(DateTime.Today.Year) Michael "XFox" Gordeev +
+ + \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Admin/Views/_ViewImports.cshtml b/MyWebsite/MyWebsite/Areas/Admin/Views/_ViewImports.cshtml index 76e750d..49f8db9 100644 --- a/MyWebsite/MyWebsite/Areas/Admin/Views/_ViewImports.cshtml +++ b/MyWebsite/MyWebsite/Areas/Admin/Views/_ViewImports.cshtml @@ -1,5 +1,4 @@ @using MyWebsite @using MyWebsite.Models @using MyWebsite.ViewModels -@using MyWebsite.Areas.Admin.Models @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/MyWebsite/MyWebsite/Areas/Projects/Controllers/FoxTubeController.cs b/MyWebsite/MyWebsite/Areas/Projects/Controllers/FoxTubeController.cs index cf34690..77f2ff4 100644 --- a/MyWebsite/MyWebsite/Areas/Projects/Controllers/FoxTubeController.cs +++ b/MyWebsite/MyWebsite/Areas/Projects/Controllers/FoxTubeController.cs @@ -10,49 +10,49 @@ using MyWebsite.Areas.Projects.Models; namespace MyWebsite.Areas.Projects.Controllers { - [Area("Projects")] - public class FoxTubeController : ExtendedController - { - readonly DatabaseContext db; - readonly List paths = new List(); - readonly List files; - public FoxTubeController(DatabaseContext context) : base(context) - { - db = context; + [Area("Projects")] + public class FoxTubeController : ExtendedController + { + readonly List paths = new List(); + readonly List files; + private FoxTubeDatabaseContext FoxTubeDatabaseContext { get; set; } - Scan(Directory.GetCurrentDirectory() + "\\wwwroot\\assets\\FoxTube\\Screenshots\\" + CultureInfo.CurrentUICulture.ThreeLetterISOLanguageName, paths); + public FoxTubeController(DatabaseContext context, FoxTubeDatabaseContext foxTubeDatabase) : base(context) + { + FoxTubeDatabaseContext = foxTubeDatabase; + Scan(Directory.GetCurrentDirectory() + "\\wwwroot\\assets\\FoxTube\\Screenshots\\" + CultureInfo.CurrentUICulture.ThreeLetterISOLanguageName, paths); - for (int i = 0; i < paths.Count; i++) - paths[i] = paths[i].Substring(paths[i].IndexOf("Screenshots", System.StringComparison.OrdinalIgnoreCase)); + for (int i = 0; i < paths.Count; i++) + paths[i] = paths[i].Substring(paths[i].IndexOf("Screenshots", System.StringComparison.OrdinalIgnoreCase)); - files = paths.Select(i => i.Substring(i.LastIndexOf('\\') + 1)).ToList(); - } + files = paths.Select(i => i.Substring(i.LastIndexOf('\\') + 1)).ToList(); + } - public IActionResult Index() => - View(new ScreenshotViewModel(db) - { - Paths = paths, - Names = files - }); + public IActionResult Index() => + View(new ScreenshotViewModel(Database) + { + Paths = paths, + Names = files + }); - public IActionResult Screenshot(string id) => - View(new ScreenshotViewModel(db) - { - Paths = paths, - Names = files, - Current = id - }); + public IActionResult Screenshot(string id) => + View(new ScreenshotViewModel(Database) + { + Paths = paths, + Names = files, + Current = id + }); - public IActionResult Privacy() => - View(new ResumeViewModel(db, CultureInfo.CurrentCulture)); + public IActionResult Privacy() => + View(new ResumeViewModel(FoxTubeDatabaseContext.PrivacyPolicies.Find(CultureInfo.CurrentCulture.TwoLetterISOLanguageName) ?? FoxTubeDatabaseContext.PrivacyPolicies.Find("en"), Database)); - void Scan(string path, List files) - { - foreach (string p in Directory.GetFiles(path)) - files.Add(p); + void Scan(string path, List files) + { + foreach (string p in Directory.GetFiles(path)) + files.Add(p); - foreach (string p in Directory.GetDirectories(path)) - Scan(p, files); - } - } + foreach (string p in Directory.GetDirectories(path)) + Scan(p, files); + } + } } \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Projects/Models/ScreenshotViewModel.cs b/MyWebsite/MyWebsite/Areas/Projects/Models/ScreenshotViewModel.cs index 6b9be80..d829384 100644 --- a/MyWebsite/MyWebsite/Areas/Projects/Models/ScreenshotViewModel.cs +++ b/MyWebsite/MyWebsite/Areas/Projects/Models/ScreenshotViewModel.cs @@ -4,16 +4,16 @@ using System.Collections.Generic; namespace MyWebsite.Areas.Projects.Models { - public class ScreenshotViewModel : ViewModelBase - { - public List Paths { get; set; } - public List Names { get; set; } - public string Current { get; set; } + public class ScreenshotViewModel : ViewModelBase + { + public List Paths { get; set; } + public List Names { get; set; } + public string Current { get; set; } - public int Position => Names.IndexOf(Current); - public string Next => Names.Count == Position + 1 ? null : Names[Position + 1]; - public string Previous => Position > 0 ? Names[Position - 1] : null; + public int Position => Names.IndexOf(Current); + public string Next => Names.Count == Position + 1 ? null : Names[Position + 1]; + public string Previous => Position > 0 ? Names[Position - 1] : null; - public ScreenshotViewModel(DatabaseContext context) : base(context) { } - } -} + public ScreenshotViewModel(DatabaseContext context) : base(context) { } + } +} \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Projects/Views/FoxTube/Index.cshtml b/MyWebsite/MyWebsite/Areas/Projects/Views/FoxTube/Index.cshtml index b3620c7..31ae8fb 100644 --- a/MyWebsite/MyWebsite/Areas/Projects/Views/FoxTube/Index.cshtml +++ b/MyWebsite/MyWebsite/Areas/Projects/Views/FoxTube/Index.cshtml @@ -1,100 +1,98 @@ @model ScreenshotViewModel @{ - ViewData["Title"] = "Meet FoxTube!"; - Layout = "_Layout.cshtml"; + ViewData["Title"] = "Meet FoxTube!"; + Layout = "_Layout.cshtml"; }
-
+
-
+
-

Back to other projects

+

Back to other projects

-

Available on

- Requires Windows 10 April 2018 Update or higher -
    -
  • PC
  • -
  • Surface Hub
  • -
  • HoloLens
  • -
+

Available on

+ Requires Windows 10 April 2018 Update or higher +
    +
  • PC
  • +
  • Surface Hub
  • +
  • HoloLens
  • +
-

Trailer

-
- -
+

Trailer

+ -

Description

-

- YouTube client for Windows 10 family devices. It's fast and convenient. It also supports live streams and 8K videos! Frequent updates will make you sure that all problems will be purged as soon as possible -

+

Description

+

+ YouTube client for Windows 10 family devices. It's fast and convenient. It also supports live streams and 8K videos! Frequent updates will make you sure that all problems will be purged as soon as possible +

-

Features

-
    -
  • New fresh view for YouTube
  • -
  • But so familiar...
  • -
  • Faster browsing: up to 40% faster than through You-know-who (Google Chrome)!
  • -
  • Nice dark theme for vampires
  • -
  • Picture-in-picture mode for hard workers
  • -
  • Download videos! Spread communism!*
  • -
  • 8K support for big ones
  • -
  • Fox on logo!
  • -
+

Features

+
    +
  • New fresh view for YouTube
  • +
  • But so familiar...
  • +
  • Faster browsing: up to 40% faster than through You-know-who (Google Chrome)!
  • +
  • Nice dark theme for vampires
  • +
  • Picture-in-picture mode for hard workers
  • +
  • Download videos! Spread communism!*
  • +
  • 8K support for big ones
  • +
  • Fox on logo!
  • +
-

Screenshots

- - +

Screenshots

+ + -

Useufl links

- +

Useufl links

+ -

Credits

-

Demo footage content

-

Trailer

- -

Screenshots and live

- +

Credits

+

Demo footage content

+

Trailer

+ +

Screenshots and live

+ -

- © @(DateTime.Today.Year) Michael Gordeev
- © @(DateTime.Today.Year) YouTube LLC -

-
+

+ © @(DateTime.Today.Year) Michael Gordeev
+ © @(DateTime.Today.Year) YouTube LLC +

+
@section Imports { - - - - + + + + } \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Projects/Views/FoxTube/Privacy.cshtml b/MyWebsite/MyWebsite/Areas/Projects/Views/FoxTube/Privacy.cshtml index b5ef455..64b55da 100644 --- a/MyWebsite/MyWebsite/Areas/Projects/Views/FoxTube/Privacy.cshtml +++ b/MyWebsite/MyWebsite/Areas/Projects/Views/FoxTube/Privacy.cshtml @@ -1,30 +1,49 @@ @model ResumeViewModel @{ - ViewData["Title"] = "Privacy policy"; - Layout = "_Layout.cshtml"; + ViewData["Title"] = "Privacy policy"; + Layout = "_Layout.cshtml"; }
-

Back to description

-

FoxTube privacy policy

-

Last update: @Model?.Resume.LastUpdate

+  Back to description +

FoxTube privacy policy

+ Last update: @Model?.Resume.LastUpdate
- @Html.Raw(Model?.Resume.Content) + @Html.Raw(Model?.Resume.Content)
@section Imports { - + } \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Projects/Views/FoxTube/Screenshot.cshtml b/MyWebsite/MyWebsite/Areas/Projects/Views/FoxTube/Screenshot.cshtml index e160358..7a9bc35 100644 --- a/MyWebsite/MyWebsite/Areas/Projects/Views/FoxTube/Screenshot.cshtml +++ b/MyWebsite/MyWebsite/Areas/Projects/Views/FoxTube/Screenshot.cshtml @@ -1,12 +1,10 @@ -@using System.IO -@using System.Globalization -@model ScreenshotViewModel +@model ScreenshotViewModel @{ ViewData["Title"] = "Screenshot"; Layout = "_Layout.cshtml"; } -
+

Back to description @if (Model.Previous != null) @@ -20,41 +18,44 @@ Next }

- -

+

@Model.Current

+
- +
+
@section Imports { } \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Projects/Views/FoxTube/_Layout.cshtml b/MyWebsite/MyWebsite/Areas/Projects/Views/FoxTube/_Layout.cshtml index 1fc0c39..37442d1 100644 --- a/MyWebsite/MyWebsite/Areas/Projects/Views/FoxTube/_Layout.cshtml +++ b/MyWebsite/MyWebsite/Areas/Projects/Views/FoxTube/_Layout.cshtml @@ -2,91 +2,89 @@ - @ViewData["Title"] - FoxTube - XFox111.NET - - + @ViewData["Title"] - FoxTube - XFox111.NET + + - - + + + - + if (menu.style.display == "none") + menu.style.display = "initial"; + else + menu.style.display = "none"; + } + - @RenderSection("Imports", false) + @RenderSection("Imports", false) - @if (IsSectionDefined("OpenGraph")) - RenderSection("OpenGraph"); - else - { - - + @if (IsSectionDefined("OpenGraph")) + RenderSection("OpenGraph"); + else + { + + - - - - - - - - - - } + + + + + + + + + + + } - - + + - -
- @RenderBody() -
+
+ @RenderBody() +
- @{ - if (IsSectionDefined("Footer")) - RenderSection("Footer"); - else - { -
- // Copyright ©@(DateTime.Today.Year) Michael "XFox" Gordeev + @{ + if (IsSectionDefined("Footer")) + RenderSection("Footer"); + else + { +
+ // Copyright ©@(DateTime.Today.Year) Michael "XFox" Gordeev -
- @foreach (LinkModel link in Model.Links.Where(i => i.DisplayInFooter).OrderBy(i => i.Order)) - { - - } -
-
- } - } +
+ @foreach (LinkModel link in Model.Links.Where(i => i.DisplayInFooter).OrderBy(i => i.Order)) + { + + } +
+
+ } + } \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Projects/Views/GUTSchedule/PrivacyPolicy.cshtml b/MyWebsite/MyWebsite/Areas/Projects/Views/GUTSchedule/PrivacyPolicy.cshtml new file mode 100644 index 0000000..d854916 --- /dev/null +++ b/MyWebsite/MyWebsite/Areas/Projects/Views/GUTSchedule/PrivacyPolicy.cshtml @@ -0,0 +1,14 @@ +@model ResumeViewModel +@{ + Layout = "/Views/Shared/_Layout.cshtml"; + ViewData["Title"] = "GUT.Schedule privacy policy"; +} + +
+

GUT.Schedule privacy policy

+

Last update: @Model?.Resume?.LastUpdate

+
+ +
+ @Html.Raw(Model?.Resume?.Content) +
\ No newline at end of file diff --git a/MyWebsite/MyWebsite/Areas/Projects/Views/_ViewImports.cshtml b/MyWebsite/MyWebsite/Areas/Projects/Views/_ViewImports.cshtml index 9b871bf..127c2f0 100644 --- a/MyWebsite/MyWebsite/Areas/Projects/Views/_ViewImports.cshtml +++ b/MyWebsite/MyWebsite/Areas/Projects/Views/_ViewImports.cshtml @@ -3,4 +3,4 @@ @using MyWebsite.Areas.Projects.Models @using MyWebsite.Models @using MyWebsite.ViewModels -@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Controllers/AdminController.cs b/MyWebsite/MyWebsite/Controllers/AdminController.cs index ceec05a..fee768c 100644 --- a/MyWebsite/MyWebsite/Controllers/AdminController.cs +++ b/MyWebsite/MyWebsite/Controllers/AdminController.cs @@ -39,11 +39,15 @@ namespace MyWebsite.Controllers CredentialModel user = Database.Users.FirstOrDefault(i => i.Email == model.Credential.Email); if (user == null || !Encryptor.VerifyHash(model?.Credential.Password, user.Password)) { + if (!Database.Users.Any()) + goto Authorize; + ModelState.AddModelError("Authorization error", "Invaild e-mail or password"); return View(new CredentialViewModel(Database, model)); } - Claim claim = new Claim(ClaimsIdentity.DefaultNameClaimType, user.Email); + Authorize: + Claim claim = new Claim(ClaimsIdentity.DefaultNameClaimType, user?.Email ?? "root"); ClaimsIdentity id = new ClaimsIdentity(new Claim[] { claim }, "ApplicationCookie", ClaimsIdentity.DefaultNameClaimType, ClaimsIdentity.DefaultRoleClaimType); await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, new ClaimsPrincipal(id)).ConfigureAwait(false); @@ -56,16 +60,5 @@ namespace MyWebsite.Controllers await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme).ConfigureAwait(false); return RedirectToAction("Login", "Admin"); } - - [AllowAnonymous] - public bool ResetPassword(string id) - { - CredentialModel user = Database.Users.Find("michael.xfox@outlook.com"); - user.Password = Encryptor.ComputeHash(id); - Database.Users.Update(user); - Database.SaveChanges(); - - return true; - } } } \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Models/Databases/FoxTubeDatabaseContext.cs b/MyWebsite/MyWebsite/Models/Databases/FoxTubeDatabaseContext.cs index c094a50..962c724 100644 --- a/MyWebsite/MyWebsite/Models/Databases/FoxTubeDatabaseContext.cs +++ b/MyWebsite/MyWebsite/Models/Databases/FoxTubeDatabaseContext.cs @@ -8,6 +8,8 @@ namespace MyWebsite.Models.Databases public DbSet Metrics { get; set; } public DbSet Messages { get; set; } public DbSet Changelogs { get; set; } + + public DbSet PrivacyPolicies { get; set; } public FoxTubeDatabaseContext(DbContextOptions options) : base(options) => Database.EnsureCreated(); diff --git a/MyWebsite/MyWebsite/Models/Databases/GUTScheduleDatabaseContext.cs b/MyWebsite/MyWebsite/Models/Databases/GUTScheduleDatabaseContext.cs new file mode 100644 index 0000000..686721d --- /dev/null +++ b/MyWebsite/MyWebsite/Models/Databases/GUTScheduleDatabaseContext.cs @@ -0,0 +1,13 @@ +using Microsoft.EntityFrameworkCore; + +namespace MyWebsite.Models.Databases +{ + public class GUTScheduleDatabaseContext : DbContext + { + public DbSet PrivacyPolicies { get; set; } + public DbSet OffsetDates { get; set; } + + public GUTScheduleDatabaseContext(DbContextOptions options) : base(options) => + Database.EnsureCreated(); + } +} \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Models/ImageModel.cs b/MyWebsite/MyWebsite/Models/ImageModel.cs index 2b509c6..b6c28dc 100644 --- a/MyWebsite/MyWebsite/Models/ImageModel.cs +++ b/MyWebsite/MyWebsite/Models/ImageModel.cs @@ -9,7 +9,7 @@ namespace MyWebsite.Models public class ImageModel { [Key] - [Column(TypeName = "varchar(20)")] + [Column(TypeName = "varchar(255)")] [DisplayName("File name")] public string FileName { get; set; } @@ -27,7 +27,6 @@ namespace MyWebsite.Models [DisplayName("Description")] public string Description => CultureInfo.CurrentUICulture.TwoLetterISOLanguageName == "ru" && !string.IsNullOrWhiteSpace(RussianDescription) ? RussianDescription : EnglishDescription; - [Required] [Column(TypeName = "text")] [DisplayName("Description (en)")] public string EnglishDescription { get; set; } diff --git a/MyWebsite/MyWebsite/Models/ProjectModel.cs b/MyWebsite/MyWebsite/Models/ProjectModel.cs index 1bc1a64..1822f43 100644 --- a/MyWebsite/MyWebsite/Models/ProjectModel.cs +++ b/MyWebsite/MyWebsite/Models/ProjectModel.cs @@ -1,4 +1,5 @@ -using System.ComponentModel; +using System; +using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Globalization; @@ -10,8 +11,14 @@ namespace MyWebsite.Models { [Key] [Required] - [DisplayName("ID (Order)")] - public decimal Id { get; set; } + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + [DisplayName("ID")] + public Guid Id { get; set; } + + [Required] + [Column(TypeName = "int")] + [DisplayName("Order")] + public int Order { get; set; } [DisplayName("Title")] public string Title => CultureInfo.CurrentUICulture.TwoLetterISOLanguageName == "ru" && !string.IsNullOrWhiteSpace(RussianTitle) ? RussianTitle : EnglishTitle; @@ -42,7 +49,6 @@ namespace MyWebsite.Models [DisplayName("Link text caption")] public string LinkCaption => CultureInfo.CurrentUICulture.TwoLetterISOLanguageName == "ru" && !string.IsNullOrWhiteSpace(RussianTitle) ? RussianLinkCaption : EnglishLinkCaption; - [Required] [Column(TypeName = "varchar(50)")] [DisplayName("Link text caption (en)")] public string EnglishLinkCaption { get; set; } diff --git a/MyWebsite/MyWebsite/MyWebsite.csproj b/MyWebsite/MyWebsite/MyWebsite.csproj index a753c5b..77fcde5 100644 --- a/MyWebsite/MyWebsite/MyWebsite.csproj +++ b/MyWebsite/MyWebsite/MyWebsite.csproj @@ -1,36 +1,26 @@ + - netcoreapp3.1 + InProcess + XFox111dotNET + Michael "XFox" Gordeev + FoxDev Studio + XFox111.NET + This is my personal website written in ASP.NET MVC + ©2020 Michael "XFox" Gordeev + https://xfox111.net/ + https://github.com/xfox111/cvwebsite - - - - - - - - - - - - all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - + + + + - - - - - - - - + \ No newline at end of file diff --git a/MyWebsite/MyWebsite/MyWebsite.csproj.user b/MyWebsite/MyWebsite/MyWebsite.csproj.user deleted file mode 100644 index 2f80bbc..0000000 --- a/MyWebsite/MyWebsite/MyWebsite.csproj.user +++ /dev/null @@ -1,13 +0,0 @@ - - - - MvcControllerEmptyScaffolder - root/Controller - 600 - False - False - False - False - 600 - - \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Startup.cs b/MyWebsite/MyWebsite/Startup.cs index 781b639..32ab11a 100644 --- a/MyWebsite/MyWebsite/Startup.cs +++ b/MyWebsite/MyWebsite/Startup.cs @@ -10,13 +10,10 @@ using MyWebsite.Models.Databases; namespace MyWebsite { - // TODO: Add reordering for contact links - // TODO: Complete project admin page - // TODO: Complete artworks admin page // TODO: FoxTube API admin page // TODO: Complete homepage - // TODO: Complete FoxTube page // TODO: Add localization system + // TODO: Add blog // TODO: Rid of JavaScript (use Blazor) public class Startup { @@ -36,6 +33,9 @@ namespace MyWebsite services.AddDbContext(options => options.UseSqlServer(Configuration.GetConnectionString("FoxTubeDB"))); + services.AddDbContext(options => + options.UseSqlServer(Configuration.GetConnectionString("GUTScheduleDB"))); + services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(options => options.LoginPath = new PathString("/Admin/Login")); diff --git a/MyWebsite/MyWebsite/ViewModels/ResumeViewModel.cs b/MyWebsite/MyWebsite/ViewModels/ResumeViewModel.cs index 45d4d1a..acac8e6 100644 --- a/MyWebsite/MyWebsite/ViewModels/ResumeViewModel.cs +++ b/MyWebsite/MyWebsite/ViewModels/ResumeViewModel.cs @@ -8,6 +8,9 @@ namespace MyWebsite.ViewModels { public ResumeModel Resume { get; } public ResumeViewModel(DatabaseContext context, CultureInfo language) : base(context) => - Resume = context.Resume.Find(language?.Name) ?? context.Resume.Find("en-US"); + Resume = context.Resume.Find(language?.TwoLetterISOLanguageName) ?? context.Resume.Find("en"); + + public ResumeViewModel(ResumeModel model, DatabaseContext context) : base(context) => + Resume = model; } } \ No newline at end of file diff --git a/MyWebsite/MyWebsite/ViewModels/ViewModelBase.cs b/MyWebsite/MyWebsite/ViewModels/ViewModelBase.cs index 57aa291..3a28e64 100644 --- a/MyWebsite/MyWebsite/ViewModels/ViewModelBase.cs +++ b/MyWebsite/MyWebsite/ViewModels/ViewModelBase.cs @@ -10,6 +10,6 @@ namespace MyWebsite.ViewModels public IEnumerable Links { get; } public ViewModelBase(DatabaseContext context) => - Links = context?.Links.ToList(); + Links = context?.Links.OrderBy(i => i.Order); } } \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Views/Admin/Index.cshtml b/MyWebsite/MyWebsite/Views/Admin/Index.cshtml index c107b14..908550e 100644 --- a/MyWebsite/MyWebsite/Views/Admin/Index.cshtml +++ b/MyWebsite/MyWebsite/Views/Admin/Index.cshtml @@ -6,23 +6,23 @@

Administration

-
-

+

diff --git a/MyWebsite/MyWebsite/Views/Gallery/Details.cshtml b/MyWebsite/MyWebsite/Views/Gallery/Details.cshtml index de604cf..0ac5392 100644 --- a/MyWebsite/MyWebsite/Views/Gallery/Details.cshtml +++ b/MyWebsite/MyWebsite/Views/Gallery/Details.cshtml @@ -4,24 +4,22 @@ }
-

- @if (Model.Previous != null) - { - @: - Previous - @:| - } -  All artworks - @if (Model.Next != null) - { - @:|  - Next - } -

+ @if (Model.Previous != null) + { + @: + Previous + @:| + } +  All artworks + @if (Model.Next != null) + { + @:|  + Next + }
- +

@Model.Current?.Title

@@ -32,13 +30,14 @@
-@section Imports { +@section Imports +{ @@ -89,7 +90,7 @@ @foreach (LinkModel item in Model.Links.Where(i => i.Name.Belongs("outlook", "linkedin", "vkontakte", "twitter", "github"))) { -

@item.Title: @((item.Url.ToString().StartsWith("mailto:") ? "" : "https:") + item.Url)

+

@item.Title: @((item.Url.ToString().StartsWith("mailto:") ? "" : "https:") + item.Url)

}
diff --git a/MyWebsite/MyWebsite/Views/Shared/Error.cshtml b/MyWebsite/MyWebsite/Views/Shared/Error.cshtml index bad7dd5..f2414f8 100644 --- a/MyWebsite/MyWebsite/Views/Shared/Error.cshtml +++ b/MyWebsite/MyWebsite/Views/Shared/Error.cshtml @@ -5,8 +5,8 @@
-

Error.

-

An error occurred while processing your request.

+

Error

+

An error occurred while processing your request.

diff --git a/MyWebsite/MyWebsite/Views/Shared/Index.cshtml b/MyWebsite/MyWebsite/Views/Shared/Index.cshtml index c1da115..f942828 100644 --- a/MyWebsite/MyWebsite/Views/Shared/Index.cshtml +++ b/MyWebsite/MyWebsite/Views/Shared/Index.cshtml @@ -8,6 +8,23 @@

- Homepage + Hi guys! This is my website. And this is its home page. Usually, homepages should look as much glorious and cool as they can. But for some inspirational reasons I've done everything except homepage. +

+

+ Well, maybe not everything... But the most of it. If I could I would leave it offline for a few more years month time. But I need it online now, so here we go.
+ Lets consider it as 0.1.2020.03.08.666 prerelease beta technical preview demo pre-RTM version. +

+

+ So you can lurk around and check other pages. I'm pretty sure they should be fine. +

+
+
Cheers,
+
Michael "XFox" Gordeev
+
+ +
\ No newline at end of file diff --git a/MyWebsite/MyWebsite/Views/Shared/Projects.cshtml b/MyWebsite/MyWebsite/Views/Shared/Projects.cshtml index 277a0ea..d477ff4 100644 --- a/MyWebsite/MyWebsite/Views/Shared/Projects.cshtml +++ b/MyWebsite/MyWebsite/Views/Shared/Projects.cshtml @@ -14,7 +14,7 @@
@if (Model.Projects.Count() > 0) { - @foreach (ProjectModel project in Model.Projects) + @foreach (ProjectModel project in Model.Projects.OrderBy(i => i.Order)) {
@@ -40,6 +40,7 @@ }
-@section Imports { +@section Imports +{ } \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Views/Shared/TopBarMenu.cshtml b/MyWebsite/MyWebsite/Views/Shared/TopBarMenu.cshtml new file mode 100644 index 0000000..e4fefbe --- /dev/null +++ b/MyWebsite/MyWebsite/Views/Shared/TopBarMenu.cshtml @@ -0,0 +1,6 @@ +
  • AboutMe();
  • + +
  • MyResume();
  • +
  • Projects();
  • +
  • Arts();
  • +
  • Contacts();
  • \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Views/Shared/_Layout.cshtml b/MyWebsite/MyWebsite/Views/Shared/_Layout.cshtml index 66c685c..d78f16e 100644 --- a/MyWebsite/MyWebsite/Views/Shared/_Layout.cshtml +++ b/MyWebsite/MyWebsite/Views/Shared/_Layout.cshtml @@ -6,12 +6,13 @@ - + +