diff --git a/Bug List.docx b/Bug List.docx new file mode 100644 index 0000000..d2d1144 Binary files /dev/null and b/Bug List.docx differ diff --git a/Final_Project.zip b/Final_Project.zip new file mode 100644 index 0000000..6cf8991 Binary files /dev/null and b/Final_Project.zip differ diff --git a/Final_Project/.vs/Final_Project/DesignTimeBuild/.dtbcache.v2 b/Final_Project/.vs/Final_Project/DesignTimeBuild/.dtbcache.v2 index f244de5..fee2f06 100644 Binary files a/Final_Project/.vs/Final_Project/DesignTimeBuild/.dtbcache.v2 and b/Final_Project/.vs/Final_Project/DesignTimeBuild/.dtbcache.v2 differ diff --git a/Final_Project/.vs/Final_Project/FileContentIndex/168112f4-a19a-47f8-8606-92790da5a0aa.vsidx b/Final_Project/.vs/Final_Project/FileContentIndex/168112f4-a19a-47f8-8606-92790da5a0aa.vsidx new file mode 100644 index 0000000..88e9dc3 Binary files /dev/null and b/Final_Project/.vs/Final_Project/FileContentIndex/168112f4-a19a-47f8-8606-92790da5a0aa.vsidx differ diff --git a/Final_Project/.vs/Final_Project/FileContentIndex/45912e9b-ce08-49d5-9da9-90f73943840f.vsidx b/Final_Project/.vs/Final_Project/FileContentIndex/45912e9b-ce08-49d5-9da9-90f73943840f.vsidx deleted file mode 100644 index dd6c9a8..0000000 Binary files a/Final_Project/.vs/Final_Project/FileContentIndex/45912e9b-ce08-49d5-9da9-90f73943840f.vsidx and /dev/null differ diff --git a/Final_Project/.vs/Final_Project/FileContentIndex/6a177db6-4387-4f4f-bd90-6490421606da.vsidx b/Final_Project/.vs/Final_Project/FileContentIndex/6a177db6-4387-4f4f-bd90-6490421606da.vsidx deleted file mode 100644 index 70b1b76..0000000 Binary files a/Final_Project/.vs/Final_Project/FileContentIndex/6a177db6-4387-4f4f-bd90-6490421606da.vsidx and /dev/null differ diff --git a/Final_Project/.vs/Final_Project/FileContentIndex/81eb12f3-b16c-43be-bcb1-89662899ae8e.vsidx b/Final_Project/.vs/Final_Project/FileContentIndex/81eb12f3-b16c-43be-bcb1-89662899ae8e.vsidx new file mode 100644 index 0000000..a266735 Binary files /dev/null and b/Final_Project/.vs/Final_Project/FileContentIndex/81eb12f3-b16c-43be-bcb1-89662899ae8e.vsidx differ diff --git a/Final_Project/.vs/Final_Project/FileContentIndex/be492f5a-276f-462d-a7ec-4a926ae24363.vsidx b/Final_Project/.vs/Final_Project/FileContentIndex/be492f5a-276f-462d-a7ec-4a926ae24363.vsidx new file mode 100644 index 0000000..808a19c Binary files /dev/null and b/Final_Project/.vs/Final_Project/FileContentIndex/be492f5a-276f-462d-a7ec-4a926ae24363.vsidx differ diff --git a/Final_Project/.vs/Final_Project/FileContentIndex/c25bee95-0531-4271-bd33-521b9f14961b.vsidx b/Final_Project/.vs/Final_Project/FileContentIndex/c25bee95-0531-4271-bd33-521b9f14961b.vsidx deleted file mode 100644 index 17bf3fc..0000000 Binary files a/Final_Project/.vs/Final_Project/FileContentIndex/c25bee95-0531-4271-bd33-521b9f14961b.vsidx and /dev/null differ diff --git a/Final_Project/.vs/Final_Project/FileContentIndex/e21aad94-31d6-4a5f-a242-1e80fad2e7e4.vsidx b/Final_Project/.vs/Final_Project/FileContentIndex/e21aad94-31d6-4a5f-a242-1e80fad2e7e4.vsidx new file mode 100644 index 0000000..9855b26 Binary files /dev/null and b/Final_Project/.vs/Final_Project/FileContentIndex/e21aad94-31d6-4a5f-a242-1e80fad2e7e4.vsidx differ diff --git a/Final_Project/.vs/Final_Project/FileContentIndex/f36e168f-26d4-41ce-a115-fad84cad024e.vsidx b/Final_Project/.vs/Final_Project/FileContentIndex/f36e168f-26d4-41ce-a115-fad84cad024e.vsidx deleted file mode 100644 index e5687fd..0000000 Binary files a/Final_Project/.vs/Final_Project/FileContentIndex/f36e168f-26d4-41ce-a115-fad84cad024e.vsidx and /dev/null differ diff --git a/Final_Project/.vs/Final_Project/v17/.futdcache.v2 b/Final_Project/.vs/Final_Project/v17/.futdcache.v2 index e914bbc..7fde00b 100644 Binary files a/Final_Project/.vs/Final_Project/v17/.futdcache.v2 and b/Final_Project/.vs/Final_Project/v17/.futdcache.v2 differ diff --git a/Final_Project/.vs/Final_Project/v17/.suo b/Final_Project/.vs/Final_Project/v17/.suo index 675057c..05cb6c6 100644 Binary files a/Final_Project/.vs/Final_Project/v17/.suo and b/Final_Project/.vs/Final_Project/v17/.suo differ diff --git a/Final_Project/.vs/Final_Project/v17/HierarchyCache.v1.txt b/Final_Project/.vs/Final_Project/v17/HierarchyCache.v1.txt new file mode 100644 index 0000000..2140d81 Binary files /dev/null and b/Final_Project/.vs/Final_Project/v17/HierarchyCache.v1.txt differ diff --git a/Final_Project/.vs/ProjectEvaluation/final_project.metadata.v5.2 b/Final_Project/.vs/ProjectEvaluation/final_project.metadata.v5.2 index 8ce40ab..82aed16 100644 Binary files a/Final_Project/.vs/ProjectEvaluation/final_project.metadata.v5.2 and b/Final_Project/.vs/ProjectEvaluation/final_project.metadata.v5.2 differ diff --git a/Final_Project/.vs/ProjectEvaluation/final_project.projects.v5.2 b/Final_Project/.vs/ProjectEvaluation/final_project.projects.v5.2 index c841e95..e956e58 100644 Binary files a/Final_Project/.vs/ProjectEvaluation/final_project.projects.v5.2 and b/Final_Project/.vs/ProjectEvaluation/final_project.projects.v5.2 differ diff --git a/Final_Project/Final_Project/Areas/AcctArea/Views/Acct/Acct.cshtml b/Final_Project/Final_Project/Areas/AcctArea/Views/Acct/Acct.cshtml index 8845a4c..e57664c 100644 --- a/Final_Project/Final_Project/Areas/AcctArea/Views/Acct/Acct.cshtml +++ b/Final_Project/Final_Project/Areas/AcctArea/Views/Acct/Acct.cshtml @@ -3,19 +3,26 @@ *@ @{ } -

Your Account

+ @if(User.IsInRole("Admin")) { +

Welcome @User.Identity?.Name

You are a site administrator

} else if(User.IsInRole("Student")) { +

Welcome @User.Identity?.Name

You are a registered Student

} else { +

Congratulations, @User.Identity?.Name on joining Team 6419 ICE!

Your account is not yet confirmed by a Mentor

} +
+ +
+

Your Account

diff --git a/Final_Project/Final_Project/Areas/MemberLinks/Controllers/LinkController.cs b/Final_Project/Final_Project/Areas/MemberLinks/Controllers/LinkController.cs new file mode 100644 index 0000000..fe92e91 --- /dev/null +++ b/Final_Project/Final_Project/Areas/MemberLinks/Controllers/LinkController.cs @@ -0,0 +1,113 @@ +using Final_Project.Areas.MemberLinks.Models.ViewModels; +using Final_Project.Areas.MemberLinks.Models; +using Final_Project.Models; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Authorization; +using System.Data; + +namespace Final_Project.Areas.MemberLinks.Controllers +{ + [Authorize(Roles = "Student, Admin")] + [Area("MemberLinks")] + public class LinkController : Controller + { + private SiteContext _siteContext; + private List links = new List(); + + public LinkController(SiteContext ctx) + { + _siteContext = ctx; + links = _siteContext.Links + .OrderBy(c => c.id) + .ToList(); + } + + [HttpGet] + public IActionResult Links(string teamType) + { + List links = new List() ; + // links = _siteContext.Links + //.OrderBy(p => p.id).ToList(); + LinksModel viewModel = new LinksModel(); + foreach (Final_Project.Areas.MemberLinks.Models.DomainModels.Link link in _siteContext.Links) + { + if(link.teamtype==teamType) + { + links.Add(link); + viewModel.type = teamType; + } + } + if(links.Count==0) + { + foreach(Final_Project.Areas.MemberLinks.Models.DomainModels.Link link in _siteContext.Links) + { + links.Add(link); + } + viewModel.type = "All"; + } + + viewModel.links = links; + return View(viewModel); + //return View(model); + } + [HttpPost] + public RedirectToActionResult Delete(int id) + { + foreach (Models.DomainModels.Link link in _siteContext.Links) + { + if (link.id == id) + { + _siteContext.Links.Remove(link); + } + } + + + //_siteContext.Messages.Remove(message); + + _siteContext.SaveChanges(); + + return RedirectToAction("Links"); + } + [HttpGet] + public IActionResult AddLink() + { + AddLinkModel model = new AddLinkModel(); + return View(model); + } + [HttpPost] + public IActionResult AddLink(AddLinkModel model) + { + + + if (ModelState.IsValid) + { + Models.DomainModels.Link link = new Models.DomainModels.Link(); + link.name = model.name; + link.LinkData = model.LinkData; + link.teamtype = model.teamtype; + + _siteContext.Links.Add(link); + _siteContext.SaveChanges(); + return View("redirect"); + } + else + { + return View(model); + } + + + } + public IActionResult Link(int id) + { + foreach (Final_Project.Areas.MemberLinks.Models.DomainModels.Link link in _siteContext.Links) + { + + if (link.id == id) + { + return View(link); + } + } + return View(); + } + } +} diff --git a/Final_Project/Final_Project/Areas/MemberLinks/Models/DomainModels/Link.cs b/Final_Project/Final_Project/Areas/MemberLinks/Models/DomainModels/Link.cs new file mode 100644 index 0000000..cdb11fa --- /dev/null +++ b/Final_Project/Final_Project/Areas/MemberLinks/Models/DomainModels/Link.cs @@ -0,0 +1,22 @@ +using Final_Project.Areas.Team.Models.ViewModels; +using System.ComponentModel.DataAnnotations; + +namespace Final_Project.Areas.MemberLinks.Models.DomainModels +{ + public class Link + { + [Required(ErrorMessage = "Please enter a resource name")] + [StringLength(100)] + public string name { get; set; } = string.Empty; + + [Required(ErrorMessage = "Please enter the link to the resource")] + [StringLength(3000)] + public string LinkData { get; set; } = string.Empty; + public string teamtype { get; set; }=string.Empty; + + [Key] + public int id { get; set; } + + } + +} diff --git a/Final_Project/Final_Project/Areas/MemberLinks/Models/LinkViewModel.cs b/Final_Project/Final_Project/Areas/MemberLinks/Models/LinkViewModel.cs new file mode 100644 index 0000000..89e95db --- /dev/null +++ b/Final_Project/Final_Project/Areas/MemberLinks/Models/LinkViewModel.cs @@ -0,0 +1,20 @@ +//using Microsoft.Build.Framework; +using Final_Project.Areas.MemberLinks.Models.DomainModels; +using Final_Project.Areas.MemberLinks.Models.ViewModels; +using System.ComponentModel.DataAnnotations; +namespace Final_Project.Areas.MemberLinks.Models +{ + public class LinkViewModel + { + [Required(ErrorMessage = "Please enter a resource name")] + [StringLength(100)] + public string name { get; set; } = string.Empty; + + [Required(ErrorMessage = "Please enter the link to the resource")] + [StringLength(3000)] + public string LinkData { get; set; } = string.Empty; + + [Key] + public int id { get; set; } + } +} diff --git a/Final_Project/Final_Project/Areas/MemberLinks/Models/LinksModel.cs b/Final_Project/Final_Project/Areas/MemberLinks/Models/LinksModel.cs new file mode 100644 index 0000000..82ca9b9 --- /dev/null +++ b/Final_Project/Final_Project/Areas/MemberLinks/Models/LinksModel.cs @@ -0,0 +1,10 @@ + +namespace Final_Project.Areas.MemberLinks.Models + +{ + public class LinksModel + { + public List links { get; set; } = null!; + public string type { get; set; }=string.Empty; + } +} diff --git a/Final_Project/Final_Project/Areas/MemberLinks/Models/ViewModels/AddLinkModel.cs b/Final_Project/Final_Project/Areas/MemberLinks/Models/ViewModels/AddLinkModel.cs new file mode 100644 index 0000000..4a8e76f --- /dev/null +++ b/Final_Project/Final_Project/Areas/MemberLinks/Models/ViewModels/AddLinkModel.cs @@ -0,0 +1,27 @@ +using Final_Project.Areas.MemberLinks.Models.DomainModels; +using System.ComponentModel.DataAnnotations; + +namespace Final_Project.Areas.MemberLinks.Models.ViewModels +{ + public class AddLinkModel + { + + + [Required(ErrorMessage = "Please enter a resource name")] + [StringLength(100)] + public string name { get; set; } = string.Empty; + + [Required(ErrorMessage = "Please enter the link to the resource")] + [StringLength(3000)] + public string LinkData { get; set; } = string.Empty; + + [Key] + public int id { get; set; } + [Required(ErrorMessage = "Please enter a team type")] + [StringLength(3,ErrorMessage ="Select a team type")] + public string teamtype { get; set; }= string.Empty; + + } + + +} diff --git a/Final_Project/Final_Project/Areas/MemberLinks/Views/Link/AddLink.cshtml b/Final_Project/Final_Project/Areas/MemberLinks/Views/Link/AddLink.cshtml new file mode 100644 index 0000000..8c07901 --- /dev/null +++ b/Final_Project/Final_Project/Areas/MemberLinks/Views/Link/AddLink.cshtml @@ -0,0 +1,52 @@ +@using Final_Project.Areas.MemberLinks.Models.ViewModels; +@model Final_Project.Areas.MemberLinks.Models.ViewModels.AddLinkModel +@{ + ViewBag.Title = "Add Resource"; +} + +

Add Team

+ +
+
+
+ +
+ +
+
+ +
+
+
+ +
+ +
+
+ +
+
+
+ + + + + diff --git a/Final_Project/Final_Project/Areas/MemberLinks/Views/Link/Links.cshtml b/Final_Project/Final_Project/Areas/MemberLinks/Views/Link/Links.cshtml new file mode 100644 index 0000000..f9b1cfe --- /dev/null +++ b/Final_Project/Final_Project/Areas/MemberLinks/Views/Link/Links.cshtml @@ -0,0 +1,76 @@ +@using Final_Project.Models.DomainModels; +@using Final_Project.Areas.MemberLinks.Models.DomainModels +@model Final_Project.Areas.MemberLinks.Models.LinksModel +@using Final_Project.Areas.Mentor.Controllers; +@{ + ViewData["Title"] = " | Teams"; +} +
+@if (!(Model.type == "All")) +{ +

@Model.type Resources

+} +else +{ +

Showing all Resources

+} + +@if (User.IsInRole("Admin")) +{ +
Add a link
+} + + + + + + + + @if (Model.links.Count() == 0) + { + + } + else + { + + @foreach (Link link in Model.links) + { + + + + @if (link.LinkData.ToLower().Contains("https://")) + { + + } + else + { + + + + } + + + + @if (User.IsInRole("Admin")) + { + + } + + + + + } + + } + + +
Resource NameLink
There are no links
@link.nameView this ResourceView this Resource +
+ +
+
+ + diff --git a/Final_Project/Final_Project/Areas/MemberLinks/Views/Link/redirect.cshtml b/Final_Project/Final_Project/Areas/MemberLinks/Views/Link/redirect.cshtml new file mode 100644 index 0000000..dd55bea --- /dev/null +++ b/Final_Project/Final_Project/Areas/MemberLinks/Views/Link/redirect.cshtml @@ -0,0 +1,3 @@ + +

Link added successfully

+Home \ No newline at end of file diff --git a/Final_Project/Final_Project/Areas/MemberLinks/Views/_ViewImports.cshtml b/Final_Project/Final_Project/Areas/MemberLinks/Views/_ViewImports.cshtml new file mode 100644 index 0000000..1e4c6b4 --- /dev/null +++ b/Final_Project/Final_Project/Areas/MemberLinks/Views/_ViewImports.cshtml @@ -0,0 +1,3 @@ +@using Final_Project +@using Final_Project.Models +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/Final_Project/Final_Project/Areas/MemberLinks/Views/_ViewStart.cshtml b/Final_Project/Final_Project/Areas/MemberLinks/Views/_ViewStart.cshtml new file mode 100644 index 0000000..a5f1004 --- /dev/null +++ b/Final_Project/Final_Project/Areas/MemberLinks/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +} diff --git a/Final_Project/Final_Project/Areas/Mentor/Controllers/UserController.cs b/Final_Project/Final_Project/Areas/Mentor/Controllers/UserController.cs index e06ea62..749a21a 100644 --- a/Final_Project/Final_Project/Areas/Mentor/Controllers/UserController.cs +++ b/Final_Project/Final_Project/Areas/Mentor/Controllers/UserController.cs @@ -6,6 +6,8 @@ using Final_Project.Models.ViewModels; using Final_Project.Areas.Mentor.Models; +using Final_Project.Areas.Mentor.Models.ViewModels; +using System.Reflection.Metadata.Ecma335; namespace Final_Project.Areas.Mentor.Controllers { @@ -15,12 +17,18 @@ public class UserController : Controller { private UserManager userManager; private RoleManager roleManager; - + private SiteContext siteContext; + private List requests = new List(); + public UserController(UserManager userMngr, - RoleManager roleMngr) + RoleManager roleMngr,SiteContext ctx) { userManager = userMngr; roleManager = roleMngr; + siteContext = ctx; + requests = siteContext.VolReqs + .OrderBy(c => c.id) + .ToList(); } public async Task Approval() @@ -31,10 +39,16 @@ public async Task Approval() user.RoleNames = await userManager.GetRolesAsync(user); users.Add(user); } + List reqs= new List(); + foreach (Final_Project.Areas.VolunteerRequest.Models.DomainModels.Request r in siteContext.VolReqs) + { + reqs.Add(r); + } UserViewModel model = new UserViewModel { Users = users, - Roles = roleManager.Roles + Roles = roleManager.Roles, + requests= reqs }; return View(model); } @@ -58,7 +72,22 @@ public async Task Delete(string id) } return RedirectToAction("Approval"); } + [HttpPost] + public RedirectToActionResult Resolve(int id) + { + foreach (Final_Project.Areas.VolunteerRequest.Models.DomainModels.Request req in siteContext.VolReqs) + { + if(req.id==id) + { + siteContext.VolReqs.Remove(req); + } + } + + siteContext.SaveChanges(); + + return RedirectToAction("Approval"); + } [HttpGet] public IActionResult Add() { @@ -161,5 +190,150 @@ public async Task CreateStudentRole() if (result.Succeeded) { } return RedirectToAction("Approval"); } + /*[HttpGet] + public RedirectToActionResult ChangePassword(string id) + { + foreach (Account Acct in userManager.Users) + { + if (Acct.Id == id) + { + Acct.PasswordHash = null ; + + Acct.RoleNames = null ; + + } + } + return RedirectToAction("Approval"); + }*/ + [HttpGet] + public async Task ResetPassword(string Id) + { + if(Id== null) + { + return RedirectToAction("FFFFFF"); + } + var acc=await userManager.FindByIdAsync(Id); + if(acc.Id == null) { + return RedirectToAction("error"); + } + //AHHHHHHHH its broken + + /* Account ac=await userManager.FindByNameAsync(userName); + Account user = new Account(); + user.UserName= User.UserName; + Account[] users = userManager.Users.ToArray() ; + IQueryable queryable = userManager.Users; + foreach (Account account in queryable) + { + if (account.UserName == userName) + { + user=account; break; + } + }*/ + + /*foreach (Account userNumber in users) + { + if (userNumber.UserName == userName) + { + user = userNumber; + } + }*/ + + var model = new Final_Project.Areas.Mentor.Models.ViewModels.ResetPasswordViewModel + { + + id = acc.Id, + Username= acc.UserName, + user=acc + + + //Username = User.Identity?.Name ?? "" + + //Massive Bugger! accounts must still be signed in for this to work properly/text for details + + }; + //model.user = acc; + return View(model); + + } + + [HttpPost] + public async Task ResetPassword(ResetPasswordViewModel model) + { + // Account acct = new Account(); + /* acct.UserName = model.Username; + acct.Id = model.id; + var pass = model.NewPassword; + model.NewPassword = pass; + model.Username=acct.UserName; + model.id = acct.Id; + model.user=acct;*/ + model.user = await userManager.FindByIdAsync(model.id); + + + if (ModelState.ErrorCount<2)//Modelstate appears to be evaluated upon button click. + //one error is expected + //due to setting of user property above in this method + { + //this works + string resetToken = await userManager.GeneratePasswordResetTokenAsync(model.user); + IdentityResult passwordChangeResult = await userManager.ResetPasswordAsync(model.user, resetToken, model.NewPassword); + TempData["message"] = "Password changed successfully"; + return RedirectToAction("Approval"); + } + + /*if(model.Username==null) + { + return RedirectToAction("false"); + }*/ + return View(model); + } + [HttpPost] + public async Task ResetPass(ResetPasswordViewModel model) + { + + string err = "errors: "; + if (ModelState.IsValid) + { + + var user = await userManager.FindByIdAsync(model.id); + string resetToken = await userManager.GeneratePasswordResetTokenAsync(model.user); + var result = await userManager.ResetPasswordAsync(model.user, resetToken,model.NewPassword); + + if (result.Succeeded) + { + TempData["message"] = "Password changed successfully"; + return RedirectToAction("Index", "Home"); + } + else + { + string errList = "ERRs: "; + foreach (IdentityError error in result.Errors) + { + errList += error.Description; + err += error.Description; + ModelState.AddModelError("", error.Description); + return View(error.Description); + } + return View(errList); + } + } + return View(err); + /*Account account = new Account(); + + model.user = account; + if (ModelState.IsValid) + { + string resetToken = await userManager.GeneratePasswordResetTokenAsync(model.user); + IdentityResult passwordChangeResult = await userManager.ResetPasswordAsync(model.user, resetToken, model.NewPassword); + TempData["message"] = "Password changed successfully"; + return RedirectToAction("Approval"); + } + else + { + + } + return RedirectToAction(model.Username);*/ + } } } \ No newline at end of file diff --git a/Final_Project/Final_Project/Areas/Mentor/Models/ResetPasswordViewModel.cs b/Final_Project/Final_Project/Areas/Mentor/Models/ResetPasswordViewModel.cs new file mode 100644 index 0000000..8eb502d --- /dev/null +++ b/Final_Project/Final_Project/Areas/Mentor/Models/ResetPasswordViewModel.cs @@ -0,0 +1,27 @@ +using Final_Project.Models.DomainModels; +using System.ComponentModel.DataAnnotations; + +namespace Final_Project.Areas.Mentor.Models.ViewModels +{ + public class ResetPasswordViewModel + { + [Required(ErrorMessage ="errr")] + public string Username { get; set; } = string.Empty; + + [Required(ErrorMessage = "Please enter your new password.")] + [MaxLength(255)] + [MinLength(6)] + [DataType(DataType.Password)] + [Compare("ConfirmPassword")] + public string NewPassword { get; set; } = string.Empty; + + [Required(ErrorMessage = "Please confirm your new password.")] + [DataType(DataType.Password)] + [Display(Name = "Confirm Password")] + public string ConfirmPassword { get; set; } = string.Empty; + + public Account user { get; set; } = null!; + + public string id { get; set; } =string.Empty; + } +} diff --git a/Final_Project/Final_Project/Areas/Mentor/Models/UserViewModel.cs b/Final_Project/Final_Project/Areas/Mentor/Models/UserViewModel.cs index 587a7b0..c5ce748 100644 --- a/Final_Project/Final_Project/Areas/Mentor/Models/UserViewModel.cs +++ b/Final_Project/Final_Project/Areas/Mentor/Models/UserViewModel.cs @@ -7,5 +7,6 @@ public class UserViewModel { public IEnumerable Users { get; set; } = null!;//this returned null public IEnumerable Roles { get; set; } = null!; + public IEnumerable requests { get; set; }=null!; } } diff --git a/Final_Project/Final_Project/Areas/Mentor/Views/User/Approval.cshtml b/Final_Project/Final_Project/Areas/Mentor/Views/User/Approval.cshtml index 0f443a8..3d38866 100644 --- a/Final_Project/Final_Project/Areas/Mentor/Views/User/Approval.cshtml +++ b/Final_Project/Final_Project/Areas/Mentor/Views/User/Approval.cshtml @@ -1,6 +1,7 @@ @using Final_Project.Models.DomainModels; @model Final_Project.Areas.Mentor.Models.UserViewModel @using Final_Project.Areas.Mentor.Controllers; + @{ ViewData["Title"] = " | Manage Users"; } @@ -11,7 +12,7 @@ - + @@ -25,52 +26,86 @@ { + + + - - + @if (!user.isRole("Admin")&&user.isRole("Student")) + { + + } + @if (user.isRole("Admin")) + { - + */ + } + @if (user.isRole("Student")&&!user.isRole("Admin")) + { + } + } @@ -78,4 +113,39 @@
UsernameRoles
UsernameEmailFirst NameLast NameRoles
@user.UserName@user.Email@user.FirstName@user.LastName @foreach (string roleName in user.RoleNames) {
@roleName
}
-
+
-
+ + +
+
+
+ } + @if (!user.isRole("Student")) + { + /*
-
+
+ +
+
+

Volunteer Requests

+ + + + + + + + + @if(Model.requests.Count()==0) + { + + } + else{ + @foreach (Final_Project.Areas.VolunteerRequest.Models.DomainModels.Request request in Model.requests) + { + + + + + + + + + } + } + +
First NameLast NameEmailPhoneReason/event/skill
There are no volunteer requests
@request.FirstName@request.LastName@request.Email@request.Phone@request.Reason +
+ +
+
diff --git a/Final_Project/Final_Project/Areas/Mentor/Views/User/ResetPassword.cshtml b/Final_Project/Final_Project/Areas/Mentor/Views/User/ResetPassword.cshtml new file mode 100644 index 0000000..f23988f --- /dev/null +++ b/Final_Project/Final_Project/Areas/Mentor/Views/User/ResetPassword.cshtml @@ -0,0 +1,43 @@ +@model Final_Project.Areas.Mentor.Models.ViewModels.ResetPasswordViewModel +@{ + ViewBag.Title = "Change Password"; +} + +

Change Password

+ +
+
+ +
+ +
+ + + + +
+ + +
+ +
+ +
+
+ +
+
+
+ +
+ +
+
+
+
+ + Cancel +
+
+ \ No newline at end of file diff --git a/Final_Project/Final_Project/Areas/Student/Controllers/HomeController.cs b/Final_Project/Final_Project/Areas/Student/Controllers/HomeController.cs index f0d8ea5..ec2acee 100644 --- a/Final_Project/Final_Project/Areas/Student/Controllers/HomeController.cs +++ b/Final_Project/Final_Project/Areas/Student/Controllers/HomeController.cs @@ -7,8 +7,8 @@ using Final_Project.Areas.Student.Models.ViewModels; using Final_Project.Areas.Student.Models.DomainModels; using Final_Project.Areas.Mentor.Models; -using Final_Project.Migrations; using Final_Project.Models; +//using migrations using static System.Runtime.InteropServices.JavaScript.JSType; namespace Final_Project.Areas.Student.Controllers diff --git a/Final_Project/Final_Project/Areas/Student/Controllers/MessageController.cs b/Final_Project/Final_Project/Areas/Student/Controllers/MessageController.cs index 6300f93..6114e57 100644 --- a/Final_Project/Final_Project/Areas/Student/Controllers/MessageController.cs +++ b/Final_Project/Final_Project/Areas/Student/Controllers/MessageController.cs @@ -1,39 +1,184 @@ using Final_Project.Areas.Student.Models.DomainModels; using Final_Project.Areas.Student.Models.ViewModels; -using Final_Project.Migrations; + +//using migrations using Final_Project.Models; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore.Metadata.Conventions; +using System.Data; namespace Final_Project.Areas.Student.Controllers { + [Area("Student")] + + [Authorize(Roles = "Student, Admin")] public class MessageController : Controller { private SiteContext _siteContext; - private Repository data { get; set; } - public MessageController(SiteContext ctx) => data = new Repository(ctx); + private List messages = new List(); + //private Repository data { get; set; } + public MessageController(SiteContext ctx) + { + _siteContext = ctx; + messages = _siteContext.Messages + .OrderBy(c => c.id) + .ToList(); + } + [HttpGet] public IActionResult Index() { return RedirectToAction("MessageBoard"); } + [HttpGet] + public IActionResult PostMessage() + { + PostMessageModel model = new PostMessageModel(); + return View(model); + } + [HttpPost] public IActionResult PostMessage(PostMessageModel model) { - List messages; + /*List messages; + messages = _siteContext.Messages .OrderBy(p => p.id).ToList(); + MessageViewModel viewModel = new MessageViewModel(); + viewModel.Messages = messages;*/ + + if (ModelState.IsValid) + { + Models.DomainModels.Message message = new Models.DomainModels.Message();//This works + message.Title = model.Title; + message.isReply = false; + message.id = model.id; + message.ParentID = 0; + message.UserName = User.Identity?.Name ?? ""; + message.Body = model.Body; + message.Replies = model.Replies; + _siteContext.Messages.Add(message); + _siteContext.SaveChanges(); + return RedirectToAction("MessageBoard"); + } + else + { + return View(model); + } - return View(messages); } - public async Task MessageBoard() + [HttpGet] + public IActionResult MessageBoard() { - List messages; + List messages; messages = _siteContext.Messages .OrderBy(p => p.id).ToList(); + MessageViewModel viewModel = new MessageViewModel(); + viewModel.Messages = messages; + return View(viewModel); + //return View(model); + } + /*[HttpPost] + public ViewResult Delete(int id) + { + foreach (Message message in _siteContext.Messages) + { + if(message.id==id) + { + _siteContext.Remove(message); + _siteContext.SaveChanges(); + } + } + + return View("MessageBoard"); + }*/ + [HttpPost] + public RedirectToActionResult Delete(int id) + { + foreach (Models.DomainModels.Message message in _siteContext.Messages) + { + if(message.id == id) + { + _siteContext.Messages.Remove(message); + } + } + + + //_siteContext.Messages.Remove(message); + + _siteContext.SaveChanges(); + + return RedirectToAction("MessageBoard"); + } + public IActionResult Message(int id) + { + foreach (Final_Project.Areas.Student.Models.DomainModels.Message message in _siteContext.Messages) + { - return View(messages); - //return View(model); + if (message.id == id) + { + return View(message); + } + } + return RedirectToAction("MessageBoard"); } + [HttpGet] + public IActionResult ReplyMessage(int parentId) + { + ReplyMessageModel model = new ReplyMessageModel(); + // model.ParentId= parentId; + return View(model); + } + [HttpPost] + public IActionResult ReplyMessage(ReplyMessageModel model) + { + /*List messages; + messages = _siteContext.Messages + .OrderBy(p => p.id).ToList(); + MessageViewModel viewModel = new MessageViewModel(); + viewModel.Messages = messages;*/ + + if (ModelState.IsValid) + { + Models.DomainModels.Message message = new Models.DomainModels.Message(); + message.Title = model.Title; + //message.id = model.id; + message.UserName = User.Identity?.Name ?? ""; + message.Body = ""; + message.Replies = model.Replies; + message.isReply = true; + foreach (Models.DomainModels.Message msg in _siteContext.Messages) + { + if(msg.id==model.id) + { + message.ParentID= msg.id; + msg.Replies.Add(message); + + } + } + + _siteContext.SaveChanges(); + return RedirectToAction("MessageBoard"); + } + else + { + return View(model); + } + + + } + public IActionResult returnToLast(int id) + { + foreach (Message msg in _siteContext.Messages) + { + if(msg.id==id) + { + return View("Message", msg); + } + } + return RedirectToAction("MessageBoard"); + } } } diff --git a/Final_Project/Final_Project/Areas/Student/Models/DataLayer/Configuration/ConfigureMessage.cs b/Final_Project/Final_Project/Areas/Student/Models/DataLayer/Configuration/ConfigureMessage.cs index 7829f01..27101a6 100644 --- a/Final_Project/Final_Project/Areas/Student/Models/DataLayer/Configuration/ConfigureMessage.cs +++ b/Final_Project/Final_Project/Areas/Student/Models/DataLayer/Configuration/ConfigureMessage.cs @@ -4,18 +4,19 @@ namespace Final_Project.Areas.Student.Models.DataLayer.Configuration { - public class ConfigureMessage : IEntityTypeConfiguration + public class ConfigureMessage : IEntityTypeConfiguration { - public void Configure(EntityTypeBuilder entity) + public void Configure(EntityTypeBuilder entity) { // seed initial data entity.HasData( - new { Title = "novel", Body = "Novel", id = "1",UserName="Null" }, - new { Title = "memoir", Body = "Memoir",id = "2", UserName = "Null" }, - new { Title = "mystery", Body = "Mystery",id = "3", UserName = "Null" }, - new { Title = "scifi", Body = "Science Fiction", id = "4", UserName = "Null" }, - new { Title = "history", Body = "History",id="5", UserName = "Null" } - ); + new { Title = "Message5", Body = "Body1", id = -6, UserName = "Null", isReply = false, ParentID = 0 }, + new { Title = "Message5", Body = "Body1", id = -1, UserName = "Null", isReply = false, ParentID = 0 }, + new { Title = "Message4", Body = "Body2", id = -2, UserName = "Null", isReply = false, ParentID = 0 }, + new { Title = "Message3", Body = "Body3", id = -3, UserName = "Null", isReply = false, ParentID = 0 }, + new { Title = "Message2", Body = "Body4", id = -4, UserName = "Null", isReply = false, ParentID = 0 }, + new { Title = "Message1", Body = "Body5", id = -5, UserName = "Null", isReply = false, ParentID = 0 } + ) ; } } diff --git a/Final_Project/Final_Project/Areas/Student/Models/DomainModels/Message.cs b/Final_Project/Final_Project/Areas/Student/Models/DomainModels/Message.cs index 85c29c6..ac2ca94 100644 --- a/Final_Project/Final_Project/Areas/Student/Models/DomainModels/Message.cs +++ b/Final_Project/Final_Project/Areas/Student/Models/DomainModels/Message.cs @@ -12,7 +12,10 @@ public class Message [StringLength(3000)] public string Body { get; set; } = string.Empty; [Key] - public string id { get; set; }= string.Empty; + public int id { get; set; } public string UserName { get; set; }=string.Empty; + public bool isReply { get; set; } + public int ParentID { get; set; } + public List Replies { get; set; } = new List(); } } diff --git a/Final_Project/Final_Project/Areas/Student/Models/ViewModels/PostMessageModel.cs b/Final_Project/Final_Project/Areas/Student/Models/ViewModels/PostMessageModel.cs index b9a456b..be4e094 100644 --- a/Final_Project/Final_Project/Areas/Student/Models/ViewModels/PostMessageModel.cs +++ b/Final_Project/Final_Project/Areas/Student/Models/ViewModels/PostMessageModel.cs @@ -1,5 +1,5 @@ using System.ComponentModel.DataAnnotations; - +using Final_Project.Areas.Student.Models.DomainModels; namespace Final_Project.Areas.Student.Models.ViewModels { public class PostMessageModel @@ -12,7 +12,10 @@ public class PostMessageModel [StringLength(3000)] public string Body { get; set; } = string.Empty; public string UserName { get; set; }= string.Empty; - public string id { get; set; }=string.Empty; + public ListReplies=null!; + public int parentId { get; set; } + bool isReply { get; set; } + public int id { get; set; } } diff --git a/Final_Project/Final_Project/Areas/Student/Models/ViewModels/ReplyMessageModel.cs b/Final_Project/Final_Project/Areas/Student/Models/ViewModels/ReplyMessageModel.cs new file mode 100644 index 0000000..1f28721 --- /dev/null +++ b/Final_Project/Final_Project/Areas/Student/Models/ViewModels/ReplyMessageModel.cs @@ -0,0 +1,20 @@ +using Final_Project.Areas.Student.Models.DomainModels; +using System.ComponentModel.DataAnnotations; + +namespace Final_Project.Areas.Student.Models.ViewModels +{ + public class ReplyMessageModel + { + [Required(ErrorMessage = "Please enter a Message.")] + [StringLength(283)] + public string Title { get; set; } = string.Empty; + + public string UserName { get; set; }= string.Empty; + public int ParentId { get; set; } + public List Replies = null!; + bool isReply { get; set; } + public int id { get; set; } + + + } +} diff --git a/Final_Project/Final_Project/Areas/Student/Views/Home/MessageBoard.cshtml b/Final_Project/Final_Project/Areas/Student/Views/Home/MessageBoard.cshtml deleted file mode 100644 index 6309004..0000000 --- a/Final_Project/Final_Project/Areas/Student/Views/Home/MessageBoard.cshtml +++ /dev/null @@ -1,33 +0,0 @@ -@using Final_Project.Areas.Student.Models.DomainModels; -@model Final_Project.Areas.Student.Models.ViewModels.MessageViewModel -@{ - ViewData["Title"] = " | Messages"; -} - -

Messages

- -
Post a message
- - - - - - - @if (Model.Messages.Count() == 0) - { - - } - else - { - - @foreach (Message msg in Model.Messages) - { - - - - - - } - - } -
MessageAction
There are no Messages
@msg.Title@msg.Body
\ No newline at end of file diff --git a/Final_Project/Final_Project/Areas/Student/Views/Message/Message.cshtml b/Final_Project/Final_Project/Areas/Student/Views/Message/Message.cshtml new file mode 100644 index 0000000..d94f199 --- /dev/null +++ b/Final_Project/Final_Project/Areas/Student/Views/Message/Message.cshtml @@ -0,0 +1,76 @@ +@using Final_Project.Areas.Student.Models.DomainModels; +@model Final_Project.Areas.Student.Models.DomainModels.Message +
+ Back +

@Model.Title

+
+
+
+

Posted by: @Model.UserName

+
+
+

@Model.Body

+
+
+ +

Replies

+
+ +
+
+ + + + + + @if (Model.Replies.Count() == 0) + { + + } + else + { + + @foreach (Message msg in Model.Replies) + { + + + + + @if(msg.Replies.Count()>0) + { + + } + else + { + + } + @if (User.IsInRole("Admin") || msg.UserName == User.Identity?.Name) + { + + } + + + } + } +
UsernameMessage
There are no Replies
@msg.UserName@msg.Title
+ +
+
+ +
+
+ +
+ diff --git a/Final_Project/Final_Project/Areas/Student/Views/Message/MessageBoard.cshtml b/Final_Project/Final_Project/Areas/Student/Views/Message/MessageBoard.cshtml new file mode 100644 index 0000000..0539952 --- /dev/null +++ b/Final_Project/Final_Project/Areas/Student/Views/Message/MessageBoard.cshtml @@ -0,0 +1,53 @@ +@using Final_Project.Areas.Student.Models.DomainModels; +@model Final_Project.Areas.Student.Models.ViewModels.MessageViewModel +@{ + ViewData["Title"] = " | Messages"; +} + +

Messages

+ +
Post a message
+ + + + + + + @if (Model.Messages.Count() == 0) + { + + } + else + { + + @foreach (Message msg in Model.Messages) + { + if(!msg.isReply) + { + + + + + + @if (User.IsInRole("Admin") || msg.UserName == User.Identity?.Name) + { + + } + + } + } + + } +
UsernameTitle
There are no Messages
@msg.UserName@msg.Title
+ +
+
+ +
+
\ No newline at end of file diff --git a/Final_Project/Final_Project/Areas/Student/Views/Home/PostMessage.cshtml b/Final_Project/Final_Project/Areas/Student/Views/Message/PostMessage.cshtml similarity index 80% rename from Final_Project/Final_Project/Areas/Student/Views/Home/PostMessage.cshtml rename to Final_Project/Final_Project/Areas/Student/Views/Message/PostMessage.cshtml index ca123ce..9618068 100644 --- a/Final_Project/Final_Project/Areas/Student/Views/Home/PostMessage.cshtml +++ b/Final_Project/Final_Project/Areas/Student/Views/Message/PostMessage.cshtml @@ -6,7 +6,7 @@

Post Message

-
+
@@ -19,7 +19,7 @@
- +
@@ -28,7 +28,7 @@
- Cancel + Cancel
diff --git a/Final_Project/Final_Project/Areas/Student/Views/Message/ReplyMessage.cshtml b/Final_Project/Final_Project/Areas/Student/Views/Message/ReplyMessage.cshtml new file mode 100644 index 0000000..27dfbc4 --- /dev/null +++ b/Final_Project/Final_Project/Areas/Student/Views/Message/ReplyMessage.cshtml @@ -0,0 +1,26 @@ +@model Final_Project.Areas.Student.Models.ViewModels.ReplyMessageModel +@{ + ViewBag.Title = "Post Reply"; +} + +

Post Reply

+ +
+
+
+ +
+ +
+
+ +
+
+ +
+
+ + Cancel +
+
+
diff --git a/Final_Project/Final_Project/Areas/Team/Controllers/ImageController.cs b/Final_Project/Final_Project/Areas/Team/Controllers/ImageController.cs new file mode 100644 index 0000000..6996b5d --- /dev/null +++ b/Final_Project/Final_Project/Areas/Team/Controllers/ImageController.cs @@ -0,0 +1,15 @@ +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Web; + +namespace Final_Project.Areas.Team.Controllers +{ + public class ImageController : Controller + { + + + } +} diff --git a/Final_Project/Final_Project/Areas/Team/Controllers/TeamController.cs b/Final_Project/Final_Project/Areas/Team/Controllers/TeamController.cs new file mode 100644 index 0000000..c0bb5a3 --- /dev/null +++ b/Final_Project/Final_Project/Areas/Team/Controllers/TeamController.cs @@ -0,0 +1,111 @@ +using Final_Project.Models; +using Microsoft.AspNetCore.Mvc; +using Final_Project.Areas.Team.Models.DomainModels; +using Final_Project.Areas.Student.Models.ViewModels; +using Final_Project.Areas.Team.Models; +using Final_Project.Areas.Team.Models.ViewModels; + +namespace Final_Project.Areas.Team.Controllers +{ + [Area("Team")] + + public class TeamController : Controller + { + private SiteContext _siteContext; + private List teems = new List(); + + public TeamController(SiteContext ctx) + { + _siteContext = ctx; + teems = _siteContext.Teams + .OrderBy(c => c.id) + .ToList(); + } + + [HttpGet] + public IActionResult Index() + { + List teams; + teams = _siteContext.Teams + .OrderBy(p => p.id).ToList(); + TeamsModel viewModel = new TeamsModel(); + viewModel.teams =teams ; + return View(viewModel); + //return View(model); + } + [HttpPost] + public RedirectToActionResult Delete(int id) + { + foreach (Models.DomainModels.Team team in _siteContext.Teams) + { + if (team.id == id) + { + _siteContext.Teams.Remove(team); + } + } + + + //_siteContext.Messages.Remove(message); + + _siteContext.SaveChanges(); + + return RedirectToAction("Index"); + } + [HttpGet] + public IActionResult AddTeam() + { + AddTeamModel model = new AddTeamModel(); + return View(model); + } + [HttpPost] + public IActionResult AddTeam(AddTeamModel model) + { + + + if (ModelState.IsValid) + { + Models.DomainModels.Team team = new Models.DomainModels.Team(); + team.number = model.Number; + team.name = model.Name; + team.about = model.about; + team.Prgm= model.Prgm; + //team.id = model.; + team.description = model.Description; + + _siteContext.Teams.Add(team); + _siteContext.SaveChanges(); + return RedirectToAction("Index"); + } + else + { + return View(model); + } + + + } + public IActionResult Team(int id) + { + foreach (Final_Project.Areas.Team.Models.DomainModels.Team team in _siteContext.Teams) + { + + if (team.id == id) + { + return View(team); + } + } + return View(); + } + public IActionResult Resources(int id) + { + foreach (Final_Project.Areas.Team.Models.DomainModels.Team team in _siteContext.Teams) + { + if (team.id == id) + { + return View(team); + } + } + return RedirectToAction("Index"); + } + + } +} diff --git a/Final_Project/Final_Project/Areas/Team/Models/DataLayer/ConfigureTeam.cs b/Final_Project/Final_Project/Areas/Team/Models/DataLayer/ConfigureTeam.cs new file mode 100644 index 0000000..4fb712a --- /dev/null +++ b/Final_Project/Final_Project/Areas/Team/Models/DataLayer/ConfigureTeam.cs @@ -0,0 +1,31 @@ +using Final_Project.Areas.Student.Models.DomainModels; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Microsoft.EntityFrameworkCore; +using Final_Project.Areas.Team.Models.DomainModels; +using Final_Project.Areas.Team.Models.ViewModels; + +namespace Final_Project.Areas.Team.Models.DataLayer +{ + internal class ConfigureTeam : IEntityTypeConfiguration + { + + + + + + + public void Configure(EntityTypeBuilder entity) + { + // seed initial data + entity.HasData( + new { number= "6419", name = "Test1",id=1,description="Description ICE",about="This is a team assocxiated with the ICE organization",Program=(TeamType)0,Prgm="FRC" }, + new { number = "Testc", name = "Test2",id=2,description= "Description Test1", about = "This is a team assocxiated with the ICE organization", Program=(TeamType)1, Prgm = "FRC" }, + new { number = "Testb", name = "Test3" ,id=3, description = "Description Test2", about = "This is a team assocxiated with the ICE organization", Program = (TeamType)1, Prgm = "FRC" }, + new { number = "Testa", name = "Test4" ,id=4, description = "Description Test3", about = "This is a team assocxiated with the ICE organization", Program = (TeamType)1, Prgm = "FRC" }, + new { number = "Test", name = "Test5" ,id=5, description = "Description Test4", about = "This is a team assocxiated with the ICE organization", Program = (TeamType)1, Prgm = "FRC" } + ); + } + + + } +} diff --git a/Final_Project/Final_Project/Areas/Team/Models/DomainModels/Team.cs b/Final_Project/Final_Project/Areas/Team/Models/DomainModels/Team.cs new file mode 100644 index 0000000..d582554 --- /dev/null +++ b/Final_Project/Final_Project/Areas/Team/Models/DomainModels/Team.cs @@ -0,0 +1,27 @@ +using Final_Project.Areas.Team.Models.ViewModels; +using System.ComponentModel.DataAnnotations; + +namespace Final_Project.Areas.Team.Models.DomainModels +{ + public class Team + { + [Required(ErrorMessage = "Please enter a team number")] + [StringLength(100)] + public string number { get; set; } = string.Empty; + + [Required(ErrorMessage = "Please enter a team name")] + [StringLength(3000)] + public string name { get; set; } = string.Empty; + [Required(ErrorMessage = "Please enter a short team slogan")] + [StringLength(3000)] + public string description { get; set; }= string.Empty; + [Required(ErrorMessage = "Please enter a long team descrption")] + [StringLength(3000)] + public string about { get; set; } = string.Empty; + [Key] + public int id { get; set; } + public string Prgm { get; set; }=string.Empty; + public TeamType Program { get; set; } + } + +} diff --git a/Final_Project/Final_Project/Areas/Team/Models/TeamViewModel.cs b/Final_Project/Final_Project/Areas/Team/Models/TeamViewModel.cs new file mode 100644 index 0000000..43d0192 --- /dev/null +++ b/Final_Project/Final_Project/Areas/Team/Models/TeamViewModel.cs @@ -0,0 +1,22 @@ +//using Microsoft.Build.Framework; +using Final_Project.Areas.Team.Models.DomainModels; +using Final_Project.Areas.Team.Models.ViewModels; +using System.ComponentModel.DataAnnotations; +namespace Final_Project.Areas.Team.Models +{ + public class TeamViewModel + { + [Required(ErrorMessage="Please enter a team name")] + public string Name { get; set; }=string.Empty; + [Required(ErrorMessage ="Please enter a team number")] + public string Number { get; set; }=string.Empty; + [Required(ErrorMessage = "Please enter a team about page body")] + public string Description { get; set; } = string.Empty; + [Required(ErrorMessage = "Please select a program type")] + //[StringLength(3000)] + public TeamType Program { get; set; } + [Required(ErrorMessage = "Please select a program type")] + public string Prgm { get; set; }=string.Empty; + + } +} diff --git a/Final_Project/Final_Project/Areas/Team/Models/TeamsModel.cs b/Final_Project/Final_Project/Areas/Team/Models/TeamsModel.cs new file mode 100644 index 0000000..8d49b06 --- /dev/null +++ b/Final_Project/Final_Project/Areas/Team/Models/TeamsModel.cs @@ -0,0 +1,9 @@ + +namespace Final_Project.Areas.Team.Models + +{ + public class TeamsModel + { + public List teams { get; set; } = null!; + } +} diff --git a/Final_Project/Final_Project/Areas/Team/Models/ViewModels/AddTeamModel.cs b/Final_Project/Final_Project/Areas/Team/Models/ViewModels/AddTeamModel.cs new file mode 100644 index 0000000..cf5f5cd --- /dev/null +++ b/Final_Project/Final_Project/Areas/Team/Models/ViewModels/AddTeamModel.cs @@ -0,0 +1,44 @@ +using Final_Project.Areas.Team.Models.DomainModels; +using System.ComponentModel.DataAnnotations; + +namespace Final_Project.Areas.Team.Models.ViewModels +{ + public class AddTeamModel + { + + + [Required(ErrorMessage = "Please enter a team number.")] + [StringLength(100)] + public string Number { get; set; } = string.Empty; + + [Required(ErrorMessage = "Please enter a Team Name.")] + [StringLength(3000)] + public string Name { get; set; } = string.Empty; + [Required(ErrorMessage = "Please enter a short team description or slogan")] + [StringLength(3000)] + public string Description { get; set; } = string.Empty; + [Required(ErrorMessage = "Please enter a long team descrption")] + [StringLength(3000)] + public string about { get; set; } = string.Empty; + [Required(ErrorMessage = "Please select a program type")] + // [StringLength(3000)] + public TeamType Program { get; set; } + [Required(ErrorMessage = "Please select a program type")] + [MinLength(3, ErrorMessage = "Select a team type")] + [MaxLength(3, ErrorMessage = "Select a team type")] + public string Prgm { get; set; }=string.Empty; + public int id { get; set; } + + + + } + public enum TeamType + { + FRC, + FTC, + FLL + } +} + + + diff --git a/Final_Project/Final_Project/Areas/Team/Views/Team/AddTeam.cshtml b/Final_Project/Final_Project/Areas/Team/Views/Team/AddTeam.cshtml new file mode 100644 index 0000000..6597afc --- /dev/null +++ b/Final_Project/Final_Project/Areas/Team/Views/Team/AddTeam.cshtml @@ -0,0 +1,69 @@ +@using Final_Project.Areas.Team.Models.ViewModels; +@model Final_Project.Areas.Team.Models.ViewModels.AddTeamModel +@{ + ViewBag.Title = "Add Team"; +} + +

Add Team

+ +
+
+
+ +
+ +
+
+ +
+
+
+ +
+ +
+
+ +
+
+
+ +
+ +
+
+ +
+
+
+ +
+ +
+
+ +
+
+
+ + +
+
+
+ + Cancel +
+
+
diff --git a/Final_Project/Final_Project/Areas/Team/Views/Team/Index.cshtml b/Final_Project/Final_Project/Areas/Team/Views/Team/Index.cshtml new file mode 100644 index 0000000..03e1c7a --- /dev/null +++ b/Final_Project/Final_Project/Areas/Team/Views/Team/Index.cshtml @@ -0,0 +1,75 @@ +@using Final_Project.Models.DomainModels; +@using Final_Project.Areas.Team.Models.DomainModels +@model Final_Project.Areas.Team.Models.TeamsModel +@using Final_Project.Areas.Mentor.Controllers; +@{ + ViewData["Title"] = " | Teams"; +} +
+

Teams

+ +@if (User.IsInRole("Admin")) +{ +
Add a team
+} + + + + + + + + @if (Model.teams.Count() == 0) + { + + } + else + { + + @foreach (Team team in Model.teams) + { + + + + + + + + @if (User.IsInRole("Admin")) + { + + + } + + + + + } + + } + + +
NumberNameDetails
There are no Teams
@team.number@team.name +
+ +
+
+
+ +
+
+ + diff --git a/Final_Project/Final_Project/Areas/Team/Views/Team/Team.cshtml b/Final_Project/Final_Project/Areas/Team/Views/Team/Team.cshtml new file mode 100644 index 0000000..f5cc2ad --- /dev/null +++ b/Final_Project/Final_Project/Areas/Team/Views/Team/Team.cshtml @@ -0,0 +1,14 @@ +@model Final_Project.Areas.Team.Models.DomainModels.Team + +

@Model.number @Model.name

+
+
+

an @Model.Prgm.ToString() Team

+
+
+

@Model.description

+
+
+

@Model.about

+Back + diff --git a/Final_Project/Final_Project/Areas/Team/Views/_ViewImports.cshtml b/Final_Project/Final_Project/Areas/Team/Views/_ViewImports.cshtml new file mode 100644 index 0000000..1e4c6b4 --- /dev/null +++ b/Final_Project/Final_Project/Areas/Team/Views/_ViewImports.cshtml @@ -0,0 +1,3 @@ +@using Final_Project +@using Final_Project.Models +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/Final_Project/Final_Project/Areas/Team/Views/_ViewStart.cshtml b/Final_Project/Final_Project/Areas/Team/Views/_ViewStart.cshtml new file mode 100644 index 0000000..a5f1004 --- /dev/null +++ b/Final_Project/Final_Project/Areas/Team/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +} diff --git a/Final_Project/Final_Project/Areas/VolunteerRequest/Controllers/RequestController.cs b/Final_Project/Final_Project/Areas/VolunteerRequest/Controllers/RequestController.cs new file mode 100644 index 0000000..b91ad86 --- /dev/null +++ b/Final_Project/Final_Project/Areas/VolunteerRequest/Controllers/RequestController.cs @@ -0,0 +1,58 @@ +using Final_Project.Areas.Team.Models.DomainModels; +using Final_Project.Areas.VolunteerRequest.Models.ViewModels; +using Final_Project.Models; +using Microsoft.AspNetCore.Mvc; + +namespace Final_Project.Areas.VolunteerRequest.Controllers +{ + [Area("VolunteerRequest")] + public class RequestController : Controller + { + private SiteContext _siteContext; + private List requests = new List(); + public RequestController(SiteContext ctx) + { + _siteContext = ctx; + requests = _siteContext.VolReqs + .OrderBy(c => c.id) + .ToList(); + } + [HttpGet] + public IActionResult Request() + { + VolunteerRequestModel model = new VolunteerRequestModel(); + return View(model); + } + [HttpPost] + public IActionResult Request(VolunteerRequestModel Model) + { + + + if (ModelState.IsValid) + { + Models.DomainModels.Request model = new Models.DomainModels.Request(); + model.Phone = Model.Phone; + model.FirstName = Model.FirstName; + model.LastName = Model.LastName; + model.Email = Model.Email; + model.Reason = Model.Reason; + + + + _siteContext.VolReqs.Add(model); + _siteContext.SaveChanges(); + return RedirectToAction("Success"); + } + else + { + return View(Model); + } + + + } + public IActionResult Success() + { + return View(); + } + } +} diff --git a/Final_Project/Final_Project/Areas/VolunteerRequest/Models/DomainModels/Request.cs b/Final_Project/Final_Project/Areas/VolunteerRequest/Models/DomainModels/Request.cs new file mode 100644 index 0000000..0ffa0fb --- /dev/null +++ b/Final_Project/Final_Project/Areas/VolunteerRequest/Models/DomainModels/Request.cs @@ -0,0 +1,35 @@ + +using PhoneNumbers; +using System.ComponentModel.DataAnnotations; + +namespace Final_Project.Areas.VolunteerRequest.Models.DomainModels +{ + public class Request + { + [Required(ErrorMessage = "Please enter your first name")] + [StringLength(100)] + public string FirstName { get; set; } = string.Empty; + + [Required(ErrorMessage = "Please enter your last name")] + [StringLength(3000)] + public string LastName { get; set; } = string.Empty; + [Required(ErrorMessage = "Please enter an email address")] + [StringLength(3000)] + + [DataType(DataType.EmailAddress)] + public string Email { get; set; }= string.Empty; + [Required(ErrorMessage = "Please enter a mobile phone number")] + + [DataType(DataType.PhoneNumber)] + [StringLength(3000)] + public string Phone { get; set; } = string.Empty; + + + [Required(ErrorMessage = "Please enter what you wish to Volunteer for")] + public string Reason { get; set; } = string.Empty; + [Key] + public int id { get; set; } + + } + +} diff --git a/Final_Project/Final_Project/Areas/VolunteerRequest/Models/ViewModels/VolunteerRequestModel.cs b/Final_Project/Final_Project/Areas/VolunteerRequest/Models/ViewModels/VolunteerRequestModel.cs new file mode 100644 index 0000000..2f04f7b --- /dev/null +++ b/Final_Project/Final_Project/Areas/VolunteerRequest/Models/ViewModels/VolunteerRequestModel.cs @@ -0,0 +1,39 @@ +using Final_Project.Areas.VolunteerRequest.Models.DomainModels; +using System.ComponentModel.DataAnnotations; + +namespace Final_Project.Areas.VolunteerRequest.Models.ViewModels +{ + public class VolunteerRequestModel + { + + + [Required(ErrorMessage = "Please enter your first name")] + [StringLength(100)] + public string FirstName { get; set; } = string.Empty; + + [Required(ErrorMessage = "Please enter your last name")] + [StringLength(3000)] + public string LastName { get; set; } = string.Empty; + [Required(ErrorMessage = "Please enter an email address")] + [StringLength(3000)] + [DataType(DataType.EmailAddress)] + public string Email { get; set; } = string.Empty; + [Required(ErrorMessage = "Please enter a mobile phone number")] + [StringLength(3000)] + [DataType(DataType.PhoneNumber)] + [RegularExpression(@"^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$", ErrorMessage = "Not a valid phone number")] + public string Phone { get; set; } = string.Empty; + + [Required(ErrorMessage = "Please enter your reason for volunteering")] + [StringLength(3000)] + public string Reason { get; set; } = string.Empty; + + public int id { get; set; } + + + + } +} + + + diff --git a/Final_Project/Final_Project/Areas/VolunteerRequest/Views/Request/Request.cshtml b/Final_Project/Final_Project/Areas/VolunteerRequest/Views/Request/Request.cshtml new file mode 100644 index 0000000..a0c2ce1 --- /dev/null +++ b/Final_Project/Final_Project/Areas/VolunteerRequest/Views/Request/Request.cshtml @@ -0,0 +1,62 @@ +@using Final_Project.Areas.VolunteerRequest.Models.ViewModels; +@model Final_Project.Areas.VolunteerRequest.Models.ViewModels.VolunteerRequestModel +@{ + ViewBag.Title = "Volunteer Request Form"; +} + +

Volunteer

+ +
+
+
+ +
+ +
+
+ +
+
+
+ +
+ +
+
+ +
+
+
+ +
+ +
+
+ +
+
+
+ +
+ +
+
+ +
+
+
+ +
+ +
+
+ +
+
+
+
+ + Cancel +
+
+
diff --git a/Final_Project/Final_Project/Areas/VolunteerRequest/Views/Request/Success.cshtml b/Final_Project/Final_Project/Areas/VolunteerRequest/Views/Request/Success.cshtml new file mode 100644 index 0000000..86d8422 --- /dev/null +++ b/Final_Project/Final_Project/Areas/VolunteerRequest/Views/Request/Success.cshtml @@ -0,0 +1,2 @@ +

Request successfully submitted

+Home diff --git a/Final_Project/Final_Project/Areas/VolunteerRequest/Views/_ViewImports.cshtml b/Final_Project/Final_Project/Areas/VolunteerRequest/Views/_ViewImports.cshtml new file mode 100644 index 0000000..1e4c6b4 --- /dev/null +++ b/Final_Project/Final_Project/Areas/VolunteerRequest/Views/_ViewImports.cshtml @@ -0,0 +1,3 @@ +@using Final_Project +@using Final_Project.Models +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/Final_Project/Final_Project/Areas/VolunteerRequest/Views/_ViewStart.cshtml b/Final_Project/Final_Project/Areas/VolunteerRequest/Views/_ViewStart.cshtml new file mode 100644 index 0000000..a5f1004 --- /dev/null +++ b/Final_Project/Final_Project/Areas/VolunteerRequest/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +} diff --git a/Final_Project/Final_Project/Controllers/HomeController.cs b/Final_Project/Final_Project/Controllers/HomeController.cs index 2ad495d..f817cda 100644 --- a/Final_Project/Final_Project/Controllers/HomeController.cs +++ b/Final_Project/Final_Project/Controllers/HomeController.cs @@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Mvc; using System.Diagnostics; using Final_Project.Models.ViewModels; +using Microsoft.AspNetCore.Mvc.Rendering; namespace Final_Project.Controllers { @@ -16,6 +17,14 @@ public HomeController(ILogger logger) public IActionResult Index() { + List Types = new() { + new SelectListItem{Value="0",Text="Member Resources"}, + new SelectListItem { Value = "1", Text = "FRC Member Resources" }, + new SelectListItem { Value = "2", Text = "FTC Member Resources" }, + new SelectListItem { Value = "3", Text = "FLL Member Resources" }, + }; + ViewBag.Types = Types; + return View(); } public IActionResult About() diff --git a/Final_Project/Final_Project/Final_Project.csproj b/Final_Project/Final_Project/Final_Project.csproj index 7a21225..b95c160 100644 --- a/Final_Project/Final_Project/Final_Project.csproj +++ b/Final_Project/Final_Project/Final_Project.csproj @@ -11,6 +11,7 @@ + @@ -18,19 +19,29 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + diff --git a/Final_Project/Final_Project/Final_Project.csproj.user b/Final_Project/Final_Project/Final_Project.csproj.user index 9a3baee..3d3f940 100644 --- a/Final_Project/Final_Project/Final_Project.csproj.user +++ b/Final_Project/Final_Project/Final_Project.csproj.user @@ -5,5 +5,8 @@ root/Common/MVC/View MvcControllerEmptyScaffolder root/Common/MVC/Controller + AreaScaffolder + root/Common + 650 \ No newline at end of file diff --git a/Final_Project/Final_Project/Home/download.png b/Final_Project/Final_Project/Home/download.png new file mode 100644 index 0000000..7d0ea9d Binary files /dev/null and b/Final_Project/Final_Project/Home/download.png differ diff --git a/Final_Project/Final_Project/Migrations/20230424193704_messag.cs b/Final_Project/Final_Project/Migrations/20230424193704_messag.cs deleted file mode 100644 index f98bfd3..0000000 --- a/Final_Project/Final_Project/Migrations/20230424193704_messag.cs +++ /dev/null @@ -1,49 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional - -namespace Final_Project.Migrations -{ - /// - public partial class messag : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Messages", - columns: table => new - { - id = table.Column(type: "nvarchar(450)", nullable: false), - Title = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), - Body = table.Column(type: "nvarchar(3000)", maxLength: 3000, nullable: false), - UserName = table.Column(type: "nvarchar(max)", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Messages", x => x.id); - }); - - migrationBuilder.InsertData( - table: "Messages", - columns: new[] { "id", "Body", "Title", "UserName" }, - values: new object[,] - { - { "1", "Novel", "novel", "Null" }, - { "2", "Memoir", "memoir", "Null" }, - { "3", "Mystery", "mystery", "Null" }, - { "4", "Science Fiction", "scifi", "Null" }, - { "5", "History", "history", "Null" } - }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Messages"); - } - } -} diff --git a/Final_Project/Final_Project/Migrations/20230424193704_messag.Designer.cs b/Final_Project/Final_Project/Migrations/20230501135302_Initial.Designer.cs similarity index 72% rename from Final_Project/Final_Project/Migrations/20230424193704_messag.Designer.cs rename to Final_Project/Final_Project/Migrations/20230501135302_Initial.Designer.cs index c271950..667c70d 100644 --- a/Final_Project/Final_Project/Migrations/20230424193704_messag.Designer.cs +++ b/Final_Project/Final_Project/Migrations/20230501135302_Initial.Designer.cs @@ -12,8 +12,8 @@ namespace Final_Project.Migrations { [DbContext(typeof(SiteContext))] - [Migration("20230424193704_messag")] - partial class messag + [Migration("20230501135302_Initial")] + partial class Initial { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -27,8 +27,11 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("Final_Project.Areas.Student.Models.DomainModels.Message", b => { - b.Property("id") - .HasColumnType("nvarchar(450)"); + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); b.Property("Body") .IsRequired() @@ -51,38 +54,128 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasData( new { - id = "1", - Body = "Novel", - Title = "novel", + id = -6, + Body = "Body1", + Title = "Message5", UserName = "Null" }, new { - id = "2", - Body = "Memoir", - Title = "memoir", + id = -1, + Body = "Body1", + Title = "Message5", UserName = "Null" }, new { - id = "3", - Body = "Mystery", - Title = "mystery", + id = -2, + Body = "Body2", + Title = "Message4", UserName = "Null" }, new { - id = "4", - Body = "Science Fiction", - Title = "scifi", + id = -3, + Body = "Body3", + Title = "Message3", UserName = "Null" }, new { - id = "5", - Body = "History", - Title = "history", + id = -4, + Body = "Body4", + Title = "Message2", UserName = "Null" + }, + new + { + id = -5, + Body = "Body5", + Title = "Message1", + UserName = "Null" + }); + }); + + modelBuilder.Entity("Final_Project.Areas.Team.Models.DomainModels.Team", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Program") + .HasColumnType("int"); + + b.Property("about") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("description") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("name") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("number") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("id"); + + b.ToTable("Teams"); + + b.HasData( + new + { + id = 1, + Program = 0, + about = "This is a team assocxiated with the ICE organization", + description = "Description ICE", + name = "Test1", + number = "6419" + }, + new + { + id = 2, + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test1", + name = "Test2", + number = "Testc" + }, + new + { + id = 3, + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test2", + name = "Test3", + number = "Testb" + }, + new + { + id = 4, + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test3", + name = "Test4", + number = "Testa" + }, + new + { + id = 5, + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test4", + name = "Test5", + number = "Test" }); }); diff --git a/Final_Project/Final_Project/Migrations/20230420131153_AddIdentityTables.cs b/Final_Project/Final_Project/Migrations/20230501135302_Initial.cs similarity index 75% rename from Final_Project/Final_Project/Migrations/20230420131153_AddIdentityTables.cs rename to Final_Project/Final_Project/Migrations/20230501135302_Initial.cs index 68f2cbc..111e147 100644 --- a/Final_Project/Final_Project/Migrations/20230420131153_AddIdentityTables.cs +++ b/Final_Project/Final_Project/Migrations/20230501135302_Initial.cs @@ -3,10 +3,12 @@ #nullable disable +#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional + namespace Final_Project.Migrations { /// - public partial class AddIdentityTables : Migration + public partial class Initial : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) @@ -52,6 +54,38 @@ protected override void Up(MigrationBuilder migrationBuilder) table.PrimaryKey("PK_AspNetUsers", x => x.Id); }); + migrationBuilder.CreateTable( + name: "Messages", + columns: table => new + { + id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Title = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Body = table.Column(type: "nvarchar(3000)", maxLength: 3000, nullable: false), + UserName = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Messages", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "Teams", + columns: table => new + { + id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + number = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + name = table.Column(type: "nvarchar(3000)", maxLength: 3000, nullable: false), + description = table.Column(type: "nvarchar(3000)", maxLength: 3000, nullable: false), + about = table.Column(type: "nvarchar(3000)", maxLength: 3000, nullable: false), + Program = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Teams", x => x.id); + }); + migrationBuilder.CreateTable( name: "AspNetRoleClaims", columns: table => new @@ -158,6 +192,31 @@ protected override void Up(MigrationBuilder migrationBuilder) onDelete: ReferentialAction.Cascade); }); + migrationBuilder.InsertData( + table: "Messages", + columns: new[] { "id", "Body", "Title", "UserName" }, + values: new object[,] + { + { -6, "Body1", "Message5", "Null" }, + { -5, "Body5", "Message1", "Null" }, + { -4, "Body4", "Message2", "Null" }, + { -3, "Body3", "Message3", "Null" }, + { -2, "Body2", "Message4", "Null" }, + { -1, "Body1", "Message5", "Null" } + }); + + migrationBuilder.InsertData( + table: "Teams", + columns: new[] { "id", "Program", "about", "description", "name", "number" }, + values: new object[,] + { + { 1, 0, "This is a team assocxiated with the ICE organization", "Description ICE", "Test1", "6419" }, + { 2, 1, "This is a team assocxiated with the ICE organization", "Description Test1", "Test2", "Testc" }, + { 3, 1, "This is a team assocxiated with the ICE organization", "Description Test2", "Test3", "Testb" }, + { 4, 1, "This is a team assocxiated with the ICE organization", "Description Test3", "Test4", "Testa" }, + { 5, 1, "This is a team assocxiated with the ICE organization", "Description Test4", "Test5", "Test" } + }); + migrationBuilder.CreateIndex( name: "IX_AspNetRoleClaims_RoleId", table: "AspNetRoleClaims", @@ -216,6 +275,12 @@ protected override void Down(MigrationBuilder migrationBuilder) migrationBuilder.DropTable( name: "AspNetUserTokens"); + migrationBuilder.DropTable( + name: "Messages"); + + migrationBuilder.DropTable( + name: "Teams"); + migrationBuilder.DropTable( name: "AspNetRoles"); diff --git a/Final_Project/Final_Project/Migrations/20230420131153_AddIdentityTables.Designer.cs b/Final_Project/Final_Project/Migrations/20230501181905_prgm.Designer.cs similarity index 62% rename from Final_Project/Final_Project/Migrations/20230420131153_AddIdentityTables.Designer.cs rename to Final_Project/Final_Project/Migrations/20230501181905_prgm.Designer.cs index fcf686b..dd1e251 100644 --- a/Final_Project/Final_Project/Migrations/20230420131153_AddIdentityTables.Designer.cs +++ b/Final_Project/Final_Project/Migrations/20230501181905_prgm.Designer.cs @@ -12,8 +12,8 @@ namespace Final_Project.Migrations { [DbContext(typeof(SiteContext))] - [Migration("20230420131153_AddIdentityTables")] - partial class AddIdentityTables + [Migration("20230501181905_prgm")] + partial class prgm { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -25,6 +25,169 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + modelBuilder.Entity("Final_Project.Areas.Student.Models.DomainModels.Message", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Body") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("UserName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("id"); + + b.ToTable("Messages"); + + b.HasData( + new + { + id = -6, + Body = "Body1", + Title = "Message5", + UserName = "Null" + }, + new + { + id = -1, + Body = "Body1", + Title = "Message5", + UserName = "Null" + }, + new + { + id = -2, + Body = "Body2", + Title = "Message4", + UserName = "Null" + }, + new + { + id = -3, + Body = "Body3", + Title = "Message3", + UserName = "Null" + }, + new + { + id = -4, + Body = "Body4", + Title = "Message2", + UserName = "Null" + }, + new + { + id = -5, + Body = "Body5", + Title = "Message1", + UserName = "Null" + }); + }); + + modelBuilder.Entity("Final_Project.Areas.Team.Models.DomainModels.Team", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Prgm") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Program") + .HasColumnType("int"); + + b.Property("about") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("description") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("name") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("number") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("id"); + + b.ToTable("Teams"); + + b.HasData( + new + { + id = 1, + Prgm = "FRC", + Program = 0, + about = "This is a team assocxiated with the ICE organization", + description = "Description ICE", + name = "Test1", + number = "6419" + }, + new + { + id = 2, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test1", + name = "Test2", + number = "Testc" + }, + new + { + id = 3, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test2", + name = "Test3", + number = "Testb" + }, + new + { + id = 4, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test3", + name = "Test4", + number = "Testa" + }, + new + { + id = 5, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test4", + name = "Test5", + number = "Test" + }); + }); + modelBuilder.Entity("Final_Project.Models.DomainModels.Account", b => { b.Property("Id") diff --git a/Final_Project/Final_Project/Migrations/20230501181905_prgm.cs b/Final_Project/Final_Project/Migrations/20230501181905_prgm.cs new file mode 100644 index 0000000..5b78446 --- /dev/null +++ b/Final_Project/Final_Project/Migrations/20230501181905_prgm.cs @@ -0,0 +1,64 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Final_Project.Migrations +{ + /// + public partial class prgm : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Prgm", + table: "Teams", + type: "nvarchar(max)", + nullable: false, + defaultValue: ""); + + migrationBuilder.UpdateData( + table: "Teams", + keyColumn: "id", + keyValue: 1, + column: "Prgm", + value: "FRC"); + + migrationBuilder.UpdateData( + table: "Teams", + keyColumn: "id", + keyValue: 2, + column: "Prgm", + value: "FRC"); + + migrationBuilder.UpdateData( + table: "Teams", + keyColumn: "id", + keyValue: 3, + column: "Prgm", + value: "FRC"); + + migrationBuilder.UpdateData( + table: "Teams", + keyColumn: "id", + keyValue: 4, + column: "Prgm", + value: "FRC"); + + migrationBuilder.UpdateData( + table: "Teams", + keyColumn: "id", + keyValue: 5, + column: "Prgm", + value: "FRC"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Prgm", + table: "Teams"); + } + } +} diff --git a/Final_Project/Final_Project/Migrations/20230424164332_messages.Designer.cs b/Final_Project/Final_Project/Migrations/20230501194954_vReqs.Designer.cs similarity index 58% rename from Final_Project/Final_Project/Migrations/20230424164332_messages.Designer.cs rename to Final_Project/Final_Project/Migrations/20230501194954_vReqs.Designer.cs index 12e1c48..5261bfb 100644 --- a/Final_Project/Final_Project/Migrations/20230424164332_messages.Designer.cs +++ b/Final_Project/Final_Project/Migrations/20230501194954_vReqs.Designer.cs @@ -12,8 +12,8 @@ namespace Final_Project.Migrations { [DbContext(typeof(SiteContext))] - [Migration("20230424164332_messages")] - partial class messages + [Migration("20230501194954_vReqs")] + partial class vReqs { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -25,6 +25,202 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + modelBuilder.Entity("Final_Project.Areas.Student.Models.DomainModels.Message", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Body") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("UserName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("id"); + + b.ToTable("Messages"); + + b.HasData( + new + { + id = -6, + Body = "Body1", + Title = "Message5", + UserName = "Null" + }, + new + { + id = -1, + Body = "Body1", + Title = "Message5", + UserName = "Null" + }, + new + { + id = -2, + Body = "Body2", + Title = "Message4", + UserName = "Null" + }, + new + { + id = -3, + Body = "Body3", + Title = "Message3", + UserName = "Null" + }, + new + { + id = -4, + Body = "Body4", + Title = "Message2", + UserName = "Null" + }, + new + { + id = -5, + Body = "Body5", + Title = "Message1", + UserName = "Null" + }); + }); + + modelBuilder.Entity("Final_Project.Areas.Team.Models.DomainModels.Team", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Prgm") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Program") + .HasColumnType("int"); + + b.Property("about") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("description") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("name") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("number") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("id"); + + b.ToTable("Teams"); + + b.HasData( + new + { + id = 1, + Prgm = "FRC", + Program = 0, + about = "This is a team assocxiated with the ICE organization", + description = "Description ICE", + name = "Test1", + number = "6419" + }, + new + { + id = 2, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test1", + name = "Test2", + number = "Testc" + }, + new + { + id = 3, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test2", + name = "Test3", + number = "Testb" + }, + new + { + id = 4, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test3", + name = "Test4", + number = "Testa" + }, + new + { + id = 5, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test4", + name = "Test5", + number = "Test" + }); + }); + + modelBuilder.Entity("Final_Project.Areas.VolunteerRequest.Models.DomainModels.Request", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Email") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.HasKey("id"); + + b.ToTable("VolReqs"); + }); + modelBuilder.Entity("Final_Project.Models.DomainModels.Account", b => { b.Property("Id") diff --git a/Final_Project/Final_Project/Migrations/20230501194954_vReqs.cs b/Final_Project/Final_Project/Migrations/20230501194954_vReqs.cs new file mode 100644 index 0000000..925141e --- /dev/null +++ b/Final_Project/Final_Project/Migrations/20230501194954_vReqs.cs @@ -0,0 +1,37 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Final_Project.Migrations +{ + /// + public partial class vReqs : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "VolReqs", + columns: table => new + { + id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + FirstName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + LastName = table.Column(type: "nvarchar(3000)", maxLength: 3000, nullable: false), + Email = table.Column(type: "nvarchar(3000)", maxLength: 3000, nullable: false), + Phone = table.Column(type: "nvarchar(3000)", maxLength: 3000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_VolReqs", x => x.id); + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "VolReqs"); + } + } +} diff --git a/Final_Project/Final_Project/Migrations/20230501223347_messageFix.Designer.cs b/Final_Project/Final_Project/Migrations/20230501223347_messageFix.Designer.cs new file mode 100644 index 0000000..f7f8a6c --- /dev/null +++ b/Final_Project/Final_Project/Migrations/20230501223347_messageFix.Designer.cs @@ -0,0 +1,502 @@ +// +using System; +using Final_Project.Models; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Final_Project.Migrations +{ + [DbContext(typeof(SiteContext))] + [Migration("20230501223347_messageFix")] + partial class messageFix + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.5") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Final_Project.Areas.Student.Models.DomainModels.Message", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Body") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("Messageid") + .HasColumnType("int"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("UserName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("id"); + + b.HasIndex("Messageid"); + + b.ToTable("Messages"); + + b.HasData( + new + { + id = -6, + Body = "Body1", + Title = "Message5", + UserName = "Null" + }, + new + { + id = -1, + Body = "Body1", + Title = "Message5", + UserName = "Null" + }, + new + { + id = -2, + Body = "Body2", + Title = "Message4", + UserName = "Null" + }, + new + { + id = -3, + Body = "Body3", + Title = "Message3", + UserName = "Null" + }, + new + { + id = -4, + Body = "Body4", + Title = "Message2", + UserName = "Null" + }, + new + { + id = -5, + Body = "Body5", + Title = "Message1", + UserName = "Null" + }); + }); + + modelBuilder.Entity("Final_Project.Areas.Team.Models.DomainModels.Team", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Prgm") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Program") + .HasColumnType("int"); + + b.Property("about") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("description") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("name") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("number") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("id"); + + b.ToTable("Teams"); + + b.HasData( + new + { + id = 1, + Prgm = "FRC", + Program = 0, + about = "This is a team assocxiated with the ICE organization", + description = "Description ICE", + name = "Test1", + number = "6419" + }, + new + { + id = 2, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test1", + name = "Test2", + number = "Testc" + }, + new + { + id = 3, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test2", + name = "Test3", + number = "Testb" + }, + new + { + id = 4, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test3", + name = "Test4", + number = "Testa" + }, + new + { + id = 5, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test4", + name = "Test5", + number = "Test" + }); + }); + + modelBuilder.Entity("Final_Project.Areas.VolunteerRequest.Models.DomainModels.Request", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Email") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.HasKey("id"); + + b.ToTable("VolReqs"); + }); + + modelBuilder.Entity("Final_Project.Models.DomainModels.Account", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("bit"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("LockoutEnabled") + .HasColumnType("bit"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("bit"); + + b.Property("SecurityStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("TwoFactorEnabled") + .HasColumnType("bit"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex") + .HasFilter("[NormalizedUserName] IS NOT NULL"); + + b.ToTable("AspNetUsers", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex") + .HasFilter("[NormalizedName] IS NOT NULL"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("nvarchar(450)"); + + b.Property("ProviderKey") + .HasColumnType("nvarchar(450)"); + + b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("RoleId") + .HasColumnType("nvarchar(450)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("LoginProvider") + .HasColumnType("nvarchar(450)"); + + b.Property("Name") + .HasColumnType("nvarchar(450)"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Final_Project.Areas.Student.Models.DomainModels.Message", b => + { + b.HasOne("Final_Project.Areas.Student.Models.DomainModels.Message", null) + .WithMany("Replies") + .HasForeignKey("Messageid"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Final_Project.Models.DomainModels.Account", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Final_Project.Models.DomainModels.Account", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Final_Project.Models.DomainModels.Account", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Final_Project.Models.DomainModels.Account", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Final_Project.Areas.Student.Models.DomainModels.Message", b => + { + b.Navigation("Replies"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Final_Project/Final_Project/Migrations/20230501223347_messageFix.cs b/Final_Project/Final_Project/Migrations/20230501223347_messageFix.cs new file mode 100644 index 0000000..195a107 --- /dev/null +++ b/Final_Project/Final_Project/Migrations/20230501223347_messageFix.cs @@ -0,0 +1,90 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Final_Project.Migrations +{ + /// + public partial class messageFix : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Messageid", + table: "Messages", + type: "int", + nullable: true); + + migrationBuilder.UpdateData( + table: "Messages", + keyColumn: "id", + keyValue: -6, + column: "Messageid", + value: null); + + migrationBuilder.UpdateData( + table: "Messages", + keyColumn: "id", + keyValue: -5, + column: "Messageid", + value: null); + + migrationBuilder.UpdateData( + table: "Messages", + keyColumn: "id", + keyValue: -4, + column: "Messageid", + value: null); + + migrationBuilder.UpdateData( + table: "Messages", + keyColumn: "id", + keyValue: -3, + column: "Messageid", + value: null); + + migrationBuilder.UpdateData( + table: "Messages", + keyColumn: "id", + keyValue: -2, + column: "Messageid", + value: null); + + migrationBuilder.UpdateData( + table: "Messages", + keyColumn: "id", + keyValue: -1, + column: "Messageid", + value: null); + + migrationBuilder.CreateIndex( + name: "IX_Messages_Messageid", + table: "Messages", + column: "Messageid"); + + migrationBuilder.AddForeignKey( + name: "FK_Messages_Messages_Messageid", + table: "Messages", + column: "Messageid", + principalTable: "Messages", + principalColumn: "id"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Messages_Messages_Messageid", + table: "Messages"); + + migrationBuilder.DropIndex( + name: "IX_Messages_Messageid", + table: "Messages"); + + migrationBuilder.DropColumn( + name: "Messageid", + table: "Messages"); + } + } +} diff --git a/Final_Project/Final_Project/Migrations/20230502001247_isReply.Designer.cs b/Final_Project/Final_Project/Migrations/20230502001247_isReply.Designer.cs new file mode 100644 index 0000000..3f22cc9 --- /dev/null +++ b/Final_Project/Final_Project/Migrations/20230502001247_isReply.Designer.cs @@ -0,0 +1,511 @@ +// +using System; +using Final_Project.Models; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Final_Project.Migrations +{ + [DbContext(typeof(SiteContext))] + [Migration("20230502001247_isReply")] + partial class isReply + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.5") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Final_Project.Areas.Student.Models.DomainModels.Message", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Body") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("Messageid") + .HasColumnType("int"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("UserName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("isReply") + .HasColumnType("bit"); + + b.HasKey("id"); + + b.HasIndex("Messageid"); + + b.ToTable("Messages"); + + b.HasData( + new + { + id = -6, + Body = "Body1", + Title = "Message5", + UserName = "Null", + isReply = false + }, + new + { + id = -1, + Body = "Body1", + Title = "Message5", + UserName = "Null", + isReply = false + }, + new + { + id = -2, + Body = "Body2", + Title = "Message4", + UserName = "Null", + isReply = false + }, + new + { + id = -3, + Body = "Body3", + Title = "Message3", + UserName = "Null", + isReply = false + }, + new + { + id = -4, + Body = "Body4", + Title = "Message2", + UserName = "Null", + isReply = false + }, + new + { + id = -5, + Body = "Body5", + Title = "Message1", + UserName = "Null", + isReply = false + }); + }); + + modelBuilder.Entity("Final_Project.Areas.Team.Models.DomainModels.Team", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Prgm") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Program") + .HasColumnType("int"); + + b.Property("about") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("description") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("name") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("number") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("id"); + + b.ToTable("Teams"); + + b.HasData( + new + { + id = 1, + Prgm = "FRC", + Program = 0, + about = "This is a team assocxiated with the ICE organization", + description = "Description ICE", + name = "Test1", + number = "6419" + }, + new + { + id = 2, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test1", + name = "Test2", + number = "Testc" + }, + new + { + id = 3, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test2", + name = "Test3", + number = "Testb" + }, + new + { + id = 4, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test3", + name = "Test4", + number = "Testa" + }, + new + { + id = 5, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test4", + name = "Test5", + number = "Test" + }); + }); + + modelBuilder.Entity("Final_Project.Areas.VolunteerRequest.Models.DomainModels.Request", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Email") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.HasKey("id"); + + b.ToTable("VolReqs"); + }); + + modelBuilder.Entity("Final_Project.Models.DomainModels.Account", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("bit"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("LockoutEnabled") + .HasColumnType("bit"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("bit"); + + b.Property("SecurityStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("TwoFactorEnabled") + .HasColumnType("bit"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex") + .HasFilter("[NormalizedUserName] IS NOT NULL"); + + b.ToTable("AspNetUsers", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex") + .HasFilter("[NormalizedName] IS NOT NULL"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("nvarchar(450)"); + + b.Property("ProviderKey") + .HasColumnType("nvarchar(450)"); + + b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("RoleId") + .HasColumnType("nvarchar(450)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("LoginProvider") + .HasColumnType("nvarchar(450)"); + + b.Property("Name") + .HasColumnType("nvarchar(450)"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Final_Project.Areas.Student.Models.DomainModels.Message", b => + { + b.HasOne("Final_Project.Areas.Student.Models.DomainModels.Message", null) + .WithMany("Replies") + .HasForeignKey("Messageid"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Final_Project.Models.DomainModels.Account", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Final_Project.Models.DomainModels.Account", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Final_Project.Models.DomainModels.Account", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Final_Project.Models.DomainModels.Account", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Final_Project.Areas.Student.Models.DomainModels.Message", b => + { + b.Navigation("Replies"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Final_Project/Final_Project/Migrations/20230502001247_isReply.cs b/Final_Project/Final_Project/Migrations/20230502001247_isReply.cs new file mode 100644 index 0000000..d150090 --- /dev/null +++ b/Final_Project/Final_Project/Migrations/20230502001247_isReply.cs @@ -0,0 +1,71 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Final_Project.Migrations +{ + /// + public partial class isReply : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "isReply", + table: "Messages", + type: "bit", + nullable: false, + defaultValue: false); + + migrationBuilder.UpdateData( + table: "Messages", + keyColumn: "id", + keyValue: -6, + column: "isReply", + value: false); + + migrationBuilder.UpdateData( + table: "Messages", + keyColumn: "id", + keyValue: -5, + column: "isReply", + value: false); + + migrationBuilder.UpdateData( + table: "Messages", + keyColumn: "id", + keyValue: -4, + column: "isReply", + value: false); + + migrationBuilder.UpdateData( + table: "Messages", + keyColumn: "id", + keyValue: -3, + column: "isReply", + value: false); + + migrationBuilder.UpdateData( + table: "Messages", + keyColumn: "id", + keyValue: -2, + column: "isReply", + value: false); + + migrationBuilder.UpdateData( + table: "Messages", + keyColumn: "id", + keyValue: -1, + column: "isReply", + value: false); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "isReply", + table: "Messages"); + } + } +} diff --git a/Final_Project/Final_Project/Migrations/20230502004339_parentid.Designer.cs b/Final_Project/Final_Project/Migrations/20230502004339_parentid.Designer.cs new file mode 100644 index 0000000..2c7f8d2 --- /dev/null +++ b/Final_Project/Final_Project/Migrations/20230502004339_parentid.Designer.cs @@ -0,0 +1,520 @@ +// +using System; +using Final_Project.Models; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Final_Project.Migrations +{ + [DbContext(typeof(SiteContext))] + [Migration("20230502004339_parentid")] + partial class parentid + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.5") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Final_Project.Areas.Student.Models.DomainModels.Message", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Body") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("Messageid") + .HasColumnType("int"); + + b.Property("ParentID") + .HasColumnType("int"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("UserName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("isReply") + .HasColumnType("bit"); + + b.HasKey("id"); + + b.HasIndex("Messageid"); + + b.ToTable("Messages"); + + b.HasData( + new + { + id = -6, + Body = "Body1", + ParentID = 0, + Title = "Message5", + UserName = "Null", + isReply = false + }, + new + { + id = -1, + Body = "Body1", + ParentID = 0, + Title = "Message5", + UserName = "Null", + isReply = false + }, + new + { + id = -2, + Body = "Body2", + ParentID = 0, + Title = "Message4", + UserName = "Null", + isReply = false + }, + new + { + id = -3, + Body = "Body3", + ParentID = 0, + Title = "Message3", + UserName = "Null", + isReply = false + }, + new + { + id = -4, + Body = "Body4", + ParentID = 0, + Title = "Message2", + UserName = "Null", + isReply = false + }, + new + { + id = -5, + Body = "Body5", + ParentID = 0, + Title = "Message1", + UserName = "Null", + isReply = false + }); + }); + + modelBuilder.Entity("Final_Project.Areas.Team.Models.DomainModels.Team", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Prgm") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Program") + .HasColumnType("int"); + + b.Property("about") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("description") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("name") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("number") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("id"); + + b.ToTable("Teams"); + + b.HasData( + new + { + id = 1, + Prgm = "FRC", + Program = 0, + about = "This is a team assocxiated with the ICE organization", + description = "Description ICE", + name = "Test1", + number = "6419" + }, + new + { + id = 2, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test1", + name = "Test2", + number = "Testc" + }, + new + { + id = 3, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test2", + name = "Test3", + number = "Testb" + }, + new + { + id = 4, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test3", + name = "Test4", + number = "Testa" + }, + new + { + id = 5, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test4", + name = "Test5", + number = "Test" + }); + }); + + modelBuilder.Entity("Final_Project.Areas.VolunteerRequest.Models.DomainModels.Request", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Email") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.HasKey("id"); + + b.ToTable("VolReqs"); + }); + + modelBuilder.Entity("Final_Project.Models.DomainModels.Account", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("bit"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("LockoutEnabled") + .HasColumnType("bit"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("bit"); + + b.Property("SecurityStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("TwoFactorEnabled") + .HasColumnType("bit"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex") + .HasFilter("[NormalizedUserName] IS NOT NULL"); + + b.ToTable("AspNetUsers", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex") + .HasFilter("[NormalizedName] IS NOT NULL"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("nvarchar(450)"); + + b.Property("ProviderKey") + .HasColumnType("nvarchar(450)"); + + b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("RoleId") + .HasColumnType("nvarchar(450)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("LoginProvider") + .HasColumnType("nvarchar(450)"); + + b.Property("Name") + .HasColumnType("nvarchar(450)"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Final_Project.Areas.Student.Models.DomainModels.Message", b => + { + b.HasOne("Final_Project.Areas.Student.Models.DomainModels.Message", null) + .WithMany("Replies") + .HasForeignKey("Messageid"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Final_Project.Models.DomainModels.Account", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Final_Project.Models.DomainModels.Account", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Final_Project.Models.DomainModels.Account", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Final_Project.Models.DomainModels.Account", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Final_Project.Areas.Student.Models.DomainModels.Message", b => + { + b.Navigation("Replies"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Final_Project/Final_Project/Migrations/20230502004339_parentid.cs b/Final_Project/Final_Project/Migrations/20230502004339_parentid.cs new file mode 100644 index 0000000..94f8630 --- /dev/null +++ b/Final_Project/Final_Project/Migrations/20230502004339_parentid.cs @@ -0,0 +1,71 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Final_Project.Migrations +{ + /// + public partial class parentid : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ParentID", + table: "Messages", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.UpdateData( + table: "Messages", + keyColumn: "id", + keyValue: -6, + column: "ParentID", + value: 0); + + migrationBuilder.UpdateData( + table: "Messages", + keyColumn: "id", + keyValue: -5, + column: "ParentID", + value: 0); + + migrationBuilder.UpdateData( + table: "Messages", + keyColumn: "id", + keyValue: -4, + column: "ParentID", + value: 0); + + migrationBuilder.UpdateData( + table: "Messages", + keyColumn: "id", + keyValue: -3, + column: "ParentID", + value: 0); + + migrationBuilder.UpdateData( + table: "Messages", + keyColumn: "id", + keyValue: -2, + column: "ParentID", + value: 0); + + migrationBuilder.UpdateData( + table: "Messages", + keyColumn: "id", + keyValue: -1, + column: "ParentID", + value: 0); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ParentID", + table: "Messages"); + } + } +} diff --git a/Final_Project/Final_Project/Migrations/20230502134822_whateveer.Designer.cs b/Final_Project/Final_Project/Migrations/20230502134822_whateveer.Designer.cs new file mode 100644 index 0000000..ca4d108 --- /dev/null +++ b/Final_Project/Final_Project/Migrations/20230502134822_whateveer.Designer.cs @@ -0,0 +1,524 @@ +// +using System; +using Final_Project.Models; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Final_Project.Migrations +{ + [DbContext(typeof(SiteContext))] + [Migration("20230502134822_whateveer")] + partial class whateveer + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.5") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Final_Project.Areas.Student.Models.DomainModels.Message", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Body") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("Messageid") + .HasColumnType("int"); + + b.Property("ParentID") + .HasColumnType("int"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("UserName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("isReply") + .HasColumnType("bit"); + + b.HasKey("id"); + + b.HasIndex("Messageid"); + + b.ToTable("Messages"); + + b.HasData( + new + { + id = -6, + Body = "Body1", + ParentID = 0, + Title = "Message5", + UserName = "Null", + isReply = false + }, + new + { + id = -1, + Body = "Body1", + ParentID = 0, + Title = "Message5", + UserName = "Null", + isReply = false + }, + new + { + id = -2, + Body = "Body2", + ParentID = 0, + Title = "Message4", + UserName = "Null", + isReply = false + }, + new + { + id = -3, + Body = "Body3", + ParentID = 0, + Title = "Message3", + UserName = "Null", + isReply = false + }, + new + { + id = -4, + Body = "Body4", + ParentID = 0, + Title = "Message2", + UserName = "Null", + isReply = false + }, + new + { + id = -5, + Body = "Body5", + ParentID = 0, + Title = "Message1", + UserName = "Null", + isReply = false + }); + }); + + modelBuilder.Entity("Final_Project.Areas.Team.Models.DomainModels.Team", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Prgm") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Program") + .HasColumnType("int"); + + b.Property("about") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("description") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("name") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("number") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("id"); + + b.ToTable("Teams"); + + b.HasData( + new + { + id = 1, + Prgm = "FRC", + Program = 0, + about = "This is a team assocxiated with the ICE organization", + description = "Description ICE", + name = "Test1", + number = "6419" + }, + new + { + id = 2, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test1", + name = "Test2", + number = "Testc" + }, + new + { + id = 3, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test2", + name = "Test3", + number = "Testb" + }, + new + { + id = 4, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test3", + name = "Test4", + number = "Testa" + }, + new + { + id = 5, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test4", + name = "Test5", + number = "Test" + }); + }); + + modelBuilder.Entity("Final_Project.Areas.VolunteerRequest.Models.DomainModels.Request", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Email") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("Reason") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("id"); + + b.ToTable("VolReqs"); + }); + + modelBuilder.Entity("Final_Project.Models.DomainModels.Account", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("bit"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("LockoutEnabled") + .HasColumnType("bit"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("bit"); + + b.Property("SecurityStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("TwoFactorEnabled") + .HasColumnType("bit"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex") + .HasFilter("[NormalizedUserName] IS NOT NULL"); + + b.ToTable("AspNetUsers", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex") + .HasFilter("[NormalizedName] IS NOT NULL"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("nvarchar(450)"); + + b.Property("ProviderKey") + .HasColumnType("nvarchar(450)"); + + b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("RoleId") + .HasColumnType("nvarchar(450)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("LoginProvider") + .HasColumnType("nvarchar(450)"); + + b.Property("Name") + .HasColumnType("nvarchar(450)"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Final_Project.Areas.Student.Models.DomainModels.Message", b => + { + b.HasOne("Final_Project.Areas.Student.Models.DomainModels.Message", null) + .WithMany("Replies") + .HasForeignKey("Messageid"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Final_Project.Models.DomainModels.Account", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Final_Project.Models.DomainModels.Account", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Final_Project.Models.DomainModels.Account", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Final_Project.Models.DomainModels.Account", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Final_Project.Areas.Student.Models.DomainModels.Message", b => + { + b.Navigation("Replies"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Final_Project/Final_Project/Migrations/20230502134822_whateveer.cs b/Final_Project/Final_Project/Migrations/20230502134822_whateveer.cs new file mode 100644 index 0000000..aef8f07 --- /dev/null +++ b/Final_Project/Final_Project/Migrations/20230502134822_whateveer.cs @@ -0,0 +1,29 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Final_Project.Migrations +{ + /// + public partial class whateveer : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Reason", + table: "VolReqs", + type: "nvarchar(max)", + nullable: false, + defaultValue: ""); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Reason", + table: "VolReqs"); + } + } +} diff --git a/Final_Project/Final_Project/Migrations/20230503020727_Links.Designer.cs b/Final_Project/Final_Project/Migrations/20230503020727_Links.Designer.cs new file mode 100644 index 0000000..3efd1bb --- /dev/null +++ b/Final_Project/Final_Project/Migrations/20230503020727_Links.Designer.cs @@ -0,0 +1,547 @@ +// +using System; +using Final_Project.Models; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Final_Project.Migrations +{ + [DbContext(typeof(SiteContext))] + [Migration("20230503020727_Links")] + partial class Links + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.5") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Final_Project.Areas.MemberLinks.Models.DomainModels.Link", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("LinkData") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("id"); + + b.ToTable("Links"); + }); + + modelBuilder.Entity("Final_Project.Areas.Student.Models.DomainModels.Message", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Body") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("Messageid") + .HasColumnType("int"); + + b.Property("ParentID") + .HasColumnType("int"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("UserName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("isReply") + .HasColumnType("bit"); + + b.HasKey("id"); + + b.HasIndex("Messageid"); + + b.ToTable("Messages"); + + b.HasData( + new + { + id = -6, + Body = "Body1", + ParentID = 0, + Title = "Message5", + UserName = "Null", + isReply = false + }, + new + { + id = -1, + Body = "Body1", + ParentID = 0, + Title = "Message5", + UserName = "Null", + isReply = false + }, + new + { + id = -2, + Body = "Body2", + ParentID = 0, + Title = "Message4", + UserName = "Null", + isReply = false + }, + new + { + id = -3, + Body = "Body3", + ParentID = 0, + Title = "Message3", + UserName = "Null", + isReply = false + }, + new + { + id = -4, + Body = "Body4", + ParentID = 0, + Title = "Message2", + UserName = "Null", + isReply = false + }, + new + { + id = -5, + Body = "Body5", + ParentID = 0, + Title = "Message1", + UserName = "Null", + isReply = false + }); + }); + + modelBuilder.Entity("Final_Project.Areas.Team.Models.DomainModels.Team", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Prgm") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Program") + .HasColumnType("int"); + + b.Property("about") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("description") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("name") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("number") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("id"); + + b.ToTable("Teams"); + + b.HasData( + new + { + id = 1, + Prgm = "FRC", + Program = 0, + about = "This is a team assocxiated with the ICE organization", + description = "Description ICE", + name = "Test1", + number = "6419" + }, + new + { + id = 2, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test1", + name = "Test2", + number = "Testc" + }, + new + { + id = 3, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test2", + name = "Test3", + number = "Testb" + }, + new + { + id = 4, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test3", + name = "Test4", + number = "Testa" + }, + new + { + id = 5, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test4", + name = "Test5", + number = "Test" + }); + }); + + modelBuilder.Entity("Final_Project.Areas.VolunteerRequest.Models.DomainModels.Request", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Email") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("Reason") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("id"); + + b.ToTable("VolReqs"); + }); + + modelBuilder.Entity("Final_Project.Models.DomainModels.Account", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("bit"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("LockoutEnabled") + .HasColumnType("bit"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("bit"); + + b.Property("SecurityStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("TwoFactorEnabled") + .HasColumnType("bit"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex") + .HasFilter("[NormalizedUserName] IS NOT NULL"); + + b.ToTable("AspNetUsers", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex") + .HasFilter("[NormalizedName] IS NOT NULL"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("nvarchar(450)"); + + b.Property("ProviderKey") + .HasColumnType("nvarchar(450)"); + + b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("RoleId") + .HasColumnType("nvarchar(450)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("LoginProvider") + .HasColumnType("nvarchar(450)"); + + b.Property("Name") + .HasColumnType("nvarchar(450)"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Final_Project.Areas.Student.Models.DomainModels.Message", b => + { + b.HasOne("Final_Project.Areas.Student.Models.DomainModels.Message", null) + .WithMany("Replies") + .HasForeignKey("Messageid"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Final_Project.Models.DomainModels.Account", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Final_Project.Models.DomainModels.Account", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Final_Project.Models.DomainModels.Account", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Final_Project.Models.DomainModels.Account", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Final_Project.Areas.Student.Models.DomainModels.Message", b => + { + b.Navigation("Replies"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Final_Project/Final_Project/Migrations/20230503020727_Links.cs b/Final_Project/Final_Project/Migrations/20230503020727_Links.cs new file mode 100644 index 0000000..4c2a1c4 --- /dev/null +++ b/Final_Project/Final_Project/Migrations/20230503020727_Links.cs @@ -0,0 +1,35 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Final_Project.Migrations +{ + /// + public partial class Links : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Links", + columns: table => new + { + id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + LinkData = table.Column(type: "nvarchar(3000)", maxLength: 3000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Links", x => x.id); + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Links"); + } + } +} diff --git a/Final_Project/Final_Project/Migrations/20230503135542_teamtype.Designer.cs b/Final_Project/Final_Project/Migrations/20230503135542_teamtype.Designer.cs new file mode 100644 index 0000000..48ca5dc --- /dev/null +++ b/Final_Project/Final_Project/Migrations/20230503135542_teamtype.Designer.cs @@ -0,0 +1,551 @@ +// +using System; +using Final_Project.Models; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Final_Project.Migrations +{ + [DbContext(typeof(SiteContext))] + [Migration("20230503135542_teamtype")] + partial class teamtype + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.5") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Final_Project.Areas.MemberLinks.Models.DomainModels.Link", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("LinkData") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("teamtype") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("id"); + + b.ToTable("Links"); + }); + + modelBuilder.Entity("Final_Project.Areas.Student.Models.DomainModels.Message", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Body") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("Messageid") + .HasColumnType("int"); + + b.Property("ParentID") + .HasColumnType("int"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("UserName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("isReply") + .HasColumnType("bit"); + + b.HasKey("id"); + + b.HasIndex("Messageid"); + + b.ToTable("Messages"); + + b.HasData( + new + { + id = -6, + Body = "Body1", + ParentID = 0, + Title = "Message5", + UserName = "Null", + isReply = false + }, + new + { + id = -1, + Body = "Body1", + ParentID = 0, + Title = "Message5", + UserName = "Null", + isReply = false + }, + new + { + id = -2, + Body = "Body2", + ParentID = 0, + Title = "Message4", + UserName = "Null", + isReply = false + }, + new + { + id = -3, + Body = "Body3", + ParentID = 0, + Title = "Message3", + UserName = "Null", + isReply = false + }, + new + { + id = -4, + Body = "Body4", + ParentID = 0, + Title = "Message2", + UserName = "Null", + isReply = false + }, + new + { + id = -5, + Body = "Body5", + ParentID = 0, + Title = "Message1", + UserName = "Null", + isReply = false + }); + }); + + modelBuilder.Entity("Final_Project.Areas.Team.Models.DomainModels.Team", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Prgm") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Program") + .HasColumnType("int"); + + b.Property("about") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("description") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("name") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("number") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("id"); + + b.ToTable("Teams"); + + b.HasData( + new + { + id = 1, + Prgm = "FRC", + Program = 0, + about = "This is a team assocxiated with the ICE organization", + description = "Description ICE", + name = "Test1", + number = "6419" + }, + new + { + id = 2, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test1", + name = "Test2", + number = "Testc" + }, + new + { + id = 3, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test2", + name = "Test3", + number = "Testb" + }, + new + { + id = 4, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test3", + name = "Test4", + number = "Testa" + }, + new + { + id = 5, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test4", + name = "Test5", + number = "Test" + }); + }); + + modelBuilder.Entity("Final_Project.Areas.VolunteerRequest.Models.DomainModels.Request", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Email") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("Reason") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("id"); + + b.ToTable("VolReqs"); + }); + + modelBuilder.Entity("Final_Project.Models.DomainModels.Account", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("bit"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("LockoutEnabled") + .HasColumnType("bit"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("bit"); + + b.Property("SecurityStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("TwoFactorEnabled") + .HasColumnType("bit"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex") + .HasFilter("[NormalizedUserName] IS NOT NULL"); + + b.ToTable("AspNetUsers", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex") + .HasFilter("[NormalizedName] IS NOT NULL"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("nvarchar(450)"); + + b.Property("ProviderKey") + .HasColumnType("nvarchar(450)"); + + b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("RoleId") + .HasColumnType("nvarchar(450)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("LoginProvider") + .HasColumnType("nvarchar(450)"); + + b.Property("Name") + .HasColumnType("nvarchar(450)"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Final_Project.Areas.Student.Models.DomainModels.Message", b => + { + b.HasOne("Final_Project.Areas.Student.Models.DomainModels.Message", null) + .WithMany("Replies") + .HasForeignKey("Messageid"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Final_Project.Models.DomainModels.Account", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Final_Project.Models.DomainModels.Account", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Final_Project.Models.DomainModels.Account", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Final_Project.Models.DomainModels.Account", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Final_Project.Areas.Student.Models.DomainModels.Message", b => + { + b.Navigation("Replies"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Final_Project/Final_Project/Migrations/20230424164332_messages.cs b/Final_Project/Final_Project/Migrations/20230503135542_teamtype.cs similarity index 50% rename from Final_Project/Final_Project/Migrations/20230424164332_messages.cs rename to Final_Project/Final_Project/Migrations/20230503135542_teamtype.cs index 03eec4a..09eb1da 100644 --- a/Final_Project/Final_Project/Migrations/20230424164332_messages.cs +++ b/Final_Project/Final_Project/Migrations/20230503135542_teamtype.cs @@ -5,18 +5,25 @@ namespace Final_Project.Migrations { /// - public partial class messages : Migration + public partial class teamtype : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { - + migrationBuilder.AddColumn( + name: "teamtype", + table: "Links", + type: "nvarchar(max)", + nullable: false, + defaultValue: ""); } /// protected override void Down(MigrationBuilder migrationBuilder) { - + migrationBuilder.DropColumn( + name: "teamtype", + table: "Links"); } } } diff --git a/Final_Project/Final_Project/Migrations/SiteContextModelSnapshot.cs b/Final_Project/Final_Project/Migrations/SiteContextModelSnapshot.cs index 70e9275..2e3ffdf 100644 --- a/Final_Project/Final_Project/Migrations/SiteContextModelSnapshot.cs +++ b/Final_Project/Final_Project/Migrations/SiteContextModelSnapshot.cs @@ -22,16 +22,52 @@ protected override void BuildModel(ModelBuilder modelBuilder) SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + modelBuilder.Entity("Final_Project.Areas.MemberLinks.Models.DomainModels.Link", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("LinkData") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("teamtype") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("id"); + + b.ToTable("Links"); + }); + modelBuilder.Entity("Final_Project.Areas.Student.Models.DomainModels.Message", b => { - b.Property("id") - .HasColumnType("nvarchar(450)"); + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); b.Property("Body") .IsRequired() .HasMaxLength(3000) .HasColumnType("nvarchar(3000)"); + b.Property("Messageid") + .HasColumnType("int"); + + b.Property("ParentID") + .HasColumnType("int"); + b.Property("Title") .IsRequired() .HasMaxLength(100) @@ -41,48 +77,201 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasColumnType("nvarchar(max)"); + b.Property("isReply") + .HasColumnType("bit"); + b.HasKey("id"); + b.HasIndex("Messageid"); + b.ToTable("Messages"); b.HasData( new { - id = "1", - Body = "Novel", - Title = "novel", - UserName = "Null" + id = -6, + Body = "Body1", + ParentID = 0, + Title = "Message5", + UserName = "Null", + isReply = false + }, + new + { + id = -1, + Body = "Body1", + ParentID = 0, + Title = "Message5", + UserName = "Null", + isReply = false + }, + new + { + id = -2, + Body = "Body2", + ParentID = 0, + Title = "Message4", + UserName = "Null", + isReply = false + }, + new + { + id = -3, + Body = "Body3", + ParentID = 0, + Title = "Message3", + UserName = "Null", + isReply = false + }, + new + { + id = -4, + Body = "Body4", + ParentID = 0, + Title = "Message2", + UserName = "Null", + isReply = false + }, + new + { + id = -5, + Body = "Body5", + ParentID = 0, + Title = "Message1", + UserName = "Null", + isReply = false + }); + }); + + modelBuilder.Entity("Final_Project.Areas.Team.Models.DomainModels.Team", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Prgm") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Program") + .HasColumnType("int"); + + b.Property("about") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("description") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("name") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("number") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("id"); + + b.ToTable("Teams"); + + b.HasData( + new + { + id = 1, + Prgm = "FRC", + Program = 0, + about = "This is a team assocxiated with the ICE organization", + description = "Description ICE", + name = "Test1", + number = "6419" }, new { - id = "2", - Body = "Memoir", - Title = "memoir", - UserName = "Null" + id = 2, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test1", + name = "Test2", + number = "Testc" }, new { - id = "3", - Body = "Mystery", - Title = "mystery", - UserName = "Null" + id = 3, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test2", + name = "Test3", + number = "Testb" }, new { - id = "4", - Body = "Science Fiction", - Title = "scifi", - UserName = "Null" + id = 4, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test3", + name = "Test4", + number = "Testa" }, new { - id = "5", - Body = "History", - Title = "history", - UserName = "Null" + id = 5, + Prgm = "FRC", + Program = 1, + about = "This is a team assocxiated with the ICE organization", + description = "Description Test4", + name = "Test5", + number = "Test" }); }); + modelBuilder.Entity("Final_Project.Areas.VolunteerRequest.Models.DomainModels.Request", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Email") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("Reason") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("id"); + + b.ToTable("VolReqs"); + }); + modelBuilder.Entity("Final_Project.Models.DomainModels.Account", b => { b.Property("Id") @@ -291,6 +480,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("AspNetUserTokens", (string)null); }); + modelBuilder.Entity("Final_Project.Areas.Student.Models.DomainModels.Message", b => + { + b.HasOne("Final_Project.Areas.Student.Models.DomainModels.Message", null) + .WithMany("Replies") + .HasForeignKey("Messageid"); + }); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => { b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) @@ -341,6 +537,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); + + modelBuilder.Entity("Final_Project.Areas.Student.Models.DomainModels.Message", b => + { + b.Navigation("Replies"); + }); #pragma warning restore 612, 618 } } diff --git a/Final_Project/Final_Project/Models/DataLayer/Configuration/ConfigureMessage.cs b/Final_Project/Final_Project/Models/DataLayer/Configuration/ConfigureMessage.cs index 0bdbb4b..2002a59 100644 --- a/Final_Project/Final_Project/Models/DataLayer/Configuration/ConfigureMessage.cs +++ b/Final_Project/Final_Project/Models/DataLayer/Configuration/ConfigureMessage.cs @@ -16,11 +16,11 @@ public void Configure(EntityTypeBuilder entity) { // seed initial data entity.HasData( - new { Title = "Testd", Body = "Test1" }, - new { Title = "Testc", Body = "Test2" }, - new { Title = "Testb", Body = "Test3" }, - new { Title = "Testa", Body = "Test4" }, - new { Title = "Test", Body = "Test5" } + new { Title = "Testd", Body = "Test1", isReply = false }, + new { Title = "Testc", Body = "Test2", isReply = false }, + new { Title = "Testb", Body = "Test3", isReply = false }, + new { Title = "Testa", Body = "Test4", isReply = false }, + new { Title = "Test", Body = "Test5", isReply = false } ); } diff --git a/Final_Project/Final_Project/Models/DataLayer/Configuration/ConfigureTeam.cs b/Final_Project/Final_Project/Models/DataLayer/Configuration/ConfigureTeam.cs new file mode 100644 index 0000000..fa58f9a --- /dev/null +++ b/Final_Project/Final_Project/Models/DataLayer/Configuration/ConfigureTeam.cs @@ -0,0 +1,30 @@ +using Final_Project.Areas.Student.Models.DomainModels; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Microsoft.EntityFrameworkCore; +using Final_Project.Areas.Team.Models.DomainModels; + +namespace Final_Project.Models.DataLayer.Configuration +{ + internal class ConfigureTeam : IEntityTypeConfiguration + { + + + + + + + public void Configure(EntityTypeBuilder entity) + { + // seed initial data + entity.HasData( + new { Title = "Testd", Body = "Test1" }, + new { Title = "Testc", Body = "Test2" }, + new { Title = "Testb", Body = "Test3" }, + new { Title = "Testa", Body = "Test4" }, + new { Title = "Test", Body = "Test5" } + ); + } + + + } +} diff --git a/Final_Project/Final_Project/Models/DomainModels/Account.cs b/Final_Project/Final_Project/Models/DomainModels/Account.cs index 3257599..6d541ca 100644 --- a/Final_Project/Final_Project/Models/DomainModels/Account.cs +++ b/Final_Project/Final_Project/Models/DomainModels/Account.cs @@ -16,5 +16,14 @@ public class Account : IdentityUser [NotMapped] public IList RoleNames { get; set; } = null!; + public bool isRole(string roleName) + { + if(RoleNames.Contains(roleName)) return true; + return false; + } + public string getName() + { + return UserName; + } } } diff --git a/Final_Project/Final_Project/Models/SiteContext.cs b/Final_Project/Final_Project/Models/SiteContext.cs index f2c4bf8..4d2de80 100644 --- a/Final_Project/Final_Project/Models/SiteContext.cs +++ b/Final_Project/Final_Project/Models/SiteContext.cs @@ -1,7 +1,7 @@ using Final_Project.Areas.Student.Models.DataLayer.Configuration; using Final_Project.Areas.Student.Models.DomainModels; using Final_Project.Models.DomainModels; - +using Final_Project.Areas.Team.Models.DataLayer; using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; @@ -14,11 +14,14 @@ public SiteContext(DbContextOptions options) { } public DbSet Messages { get; set; } = null!; - + public DbSet Teams { get; set; } = null!; + public DbSet VolReqs { get; set; } = null!; + public DbSet Links { get; set; } = null!; protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); modelBuilder.ApplyConfiguration(new ConfigureMessage()); + modelBuilder.ApplyConfiguration(new ConfigureTeam()); // configure entities } diff --git a/Final_Project/Final_Project/Program.cs b/Final_Project/Final_Project/Program.cs index acdb7be..50738ec 100644 --- a/Final_Project/Final_Project/Program.cs +++ b/Final_Project/Final_Project/Program.cs @@ -57,6 +57,21 @@ areaName: "AcctArea", pattern: "Acct/{controller=Acct}/{action=Acct}/{id?}" ); +app.MapAreaControllerRoute( + name: "Team", + areaName: "Team", + pattern: "Team/{controller=Team}/{action=Index}/{id?}" + ); +app.MapAreaControllerRoute( + name: "VolunteerRequest", + areaName: "VolunteerRequest", + pattern: "VolunteerRequest/{controller=Request}/{action=Request}/{id?}" + ); +app.MapAreaControllerRoute( + name: "MemberLinks", + areaName: "MemberLinks", + pattern: "MemberLinks/{controller=Link}/{action=Links}/{id?}" + ); app.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); diff --git a/Final_Project/Final_Project/ScaffoldingReadMe.txt b/Final_Project/Final_Project/ScaffoldingReadMe.txt new file mode 100644 index 0000000..0d0977c --- /dev/null +++ b/Final_Project/Final_Project/ScaffoldingReadMe.txt @@ -0,0 +1,12 @@ +Scaffolding has generated all the files and added the required dependencies. + +However the Application's Startup code may require additional changes for things to work end to end. +Add the following code to the Configure method in your Application's Startup class if not already done: + + app.UseEndpoints(endpoints => + { + endpoints.MapControllerRoute( + name : "areas", + pattern : "{area:exists}/{controller=Home}/{action=Index}/{id?}" + ); + }); diff --git a/Final_Project/Final_Project/Views/Home/About.cshtml b/Final_Project/Final_Project/Views/Home/About.cshtml index ae91578..7bebfd6 100644 --- a/Final_Project/Final_Project/Views/Home/About.cshtml +++ b/Final_Project/Final_Project/Views/Home/About.cshtml @@ -4,5 +4,6 @@

About 6419

-

UNDER CONSTRUCTION

+

STATIC PAGE UNDER CONSTRUCTION

+ Ice Image
diff --git a/Final_Project/Final_Project/Views/Shared/_Layout.cshtml b/Final_Project/Final_Project/Views/Shared/_Layout.cshtml index c77a9b2..2b189cb 100644 --- a/Final_Project/Final_Project/Views/Shared/_Layout.cshtml +++ b/Final_Project/Final_Project/Views/Shared/_Layout.cshtml @@ -12,7 +12,7 @@