aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaulius Klezys <paul4618@edu.easj.dk>2017-05-22 11:20:41 +0200
committerPaulius Klezys <paul4618@edu.easj.dk>2017-05-22 11:20:41 +0200
commit60385d4477827ed0c75ff2f3800a5c0a7b60ec4d (patch)
tree151b7a439c725fa180f59b214ce59773a8608a52
parent27515d443a8eab66f4195490a989f0be6561ff45 (diff)
parent590ce43270fa4f825d964b571c50e2542b2fb15b (diff)
Merge branch 'master' of https://github.com/marcinzelent/ApartmentAdmin
-rw-r--r--ApartmentManager/ApartmentManager/ApartmentManager.csproj7
-rw-r--r--ApartmentManager/ApartmentManager/AppShell.xaml.cs2
-rw-r--r--ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs26
-rw-r--r--ApartmentManager/ApartmentManager/Handler/BoardMemberHandler.cs18
-rw-r--r--ApartmentManager/ApartmentManager/Handler/BoardResidentsHandler.cs24
-rw-r--r--ApartmentManager/ApartmentManager/Handler/LoginHandler.cs2
-rw-r--r--ApartmentManager/ApartmentManager/Model/Apartment.cs41
-rw-r--r--ApartmentManager/ApartmentManager/Model/Defect.cs37
-rw-r--r--ApartmentManager/ApartmentManager/Model/Resident.cs29
-rw-r--r--ApartmentManager/ApartmentManager/Model/User.cs22
-rw-r--r--ApartmentManager/ApartmentManager/Persistency/PersistenceFacade.cs2
-rw-r--r--ApartmentManager/ApartmentManager/Singletons/CatalogSingleton.cs11
-rw-r--r--ApartmentManager/ApartmentManager/View/ApartmentDefectPage.xaml2
-rw-r--r--ApartmentManager/ApartmentManager/View/ApartmentDefectPage.xaml.cs5
-rw-r--r--ApartmentManager/ApartmentManager/View/ApartmentDefectViewPagexaml.xaml37
-rw-r--r--ApartmentManager/ApartmentManager/View/ApartmentDefectViewPagexaml.xaml.cs30
-rw-r--r--ApartmentManager/ApartmentManager/View/ApartmentNewDefect.xaml15
-rw-r--r--ApartmentManager/ApartmentManager/View/ApartmentResidentsPage.xaml.cs5
-rw-r--r--ApartmentManager/ApartmentManager/View/LoginPage.xaml2
-rw-r--r--ApartmentManager/ApartmentManager/View/LoginPage.xaml.cs5
-rw-r--r--ApartmentManager/ApartmentManager/ViewModel/BoardMemberViewModel.cs2
-rw-r--r--ApartmentManager/ApartmentManager/ViewModel/LoginViewModel.cs3
-rw-r--r--ApartmentManager/HousingWebAPI/Models/database_firewall_rules.cs38
-rw-r--r--ApartmentManager/HousingWebApi/Controllers/AllResidentsController.cs133
-rw-r--r--ApartmentManager/HousingWebApi/Controllers/ApartmentChangesController.cs133
-rw-r--r--ApartmentManager/HousingWebApi/Controllers/ApartmentResidentsController.cs133
-rw-r--r--ApartmentManager/HousingWebApi/Controllers/ApartmentsController.cs8
-rw-r--r--ApartmentManager/HousingWebApi/Controllers/ChangeCommentsController.cs133
-rw-r--r--ApartmentManager/HousingWebApi/Controllers/ChangeDocumentsController.cs133
-rw-r--r--ApartmentManager/HousingWebApi/Controllers/DefectCommentsController.cs (renamed from ApartmentManager/HousingWebApi/Controllers/PastContractOwnersController.cs)60
-rw-r--r--ApartmentManager/HousingWebApi/Controllers/DefectPicturesController.cs133
-rw-r--r--ApartmentManager/HousingWebApi/Controllers/DefectsController.cs8
-rw-r--r--ApartmentManager/HousingWebApi/Controllers/PastUsersController.cs133
-rw-r--r--ApartmentManager/HousingWebApi/Controllers/ResidentsController.cs31
-rw-r--r--ApartmentManager/HousingWebApi/Controllers/UsersController.cs37
-rw-r--r--ApartmentManager/HousingWebApi/DataModel.cs131
-rw-r--r--ApartmentManager/HousingWebApi/HousingWebApi.csproj330
-rw-r--r--ApartmentManager/HousingWebApi/Models/Apartment.cs28
-rw-r--r--ApartmentManager/HousingWebApi/Models/ApartmentChange.cs44
-rw-r--r--ApartmentManager/HousingWebApi/Models/ApartmentResident.cs (renamed from ApartmentManager/HousingWebAPI/Models/ApartmentResident.cs)0
-rw-r--r--ApartmentManager/HousingWebApi/Models/ChangeComment.cs22
-rw-r--r--ApartmentManager/HousingWebApi/Models/ChangeDocument.cs22
-rw-r--r--ApartmentManager/HousingWebApi/Models/Defect.cs39
-rw-r--r--ApartmentManager/HousingWebApi/Models/DefectComment.cs (renamed from ApartmentManager/HousingWebApi/Models/PastContractOwner.cs)13
-rw-r--r--ApartmentManager/HousingWebApi/Models/DefectPicture.cs22
-rw-r--r--ApartmentManager/HousingWebApi/Models/PastUser.cs49
-rw-r--r--ApartmentManager/HousingWebApi/Models/Resident.cs21
-rw-r--r--ApartmentManager/HousingWebApi/Models/ResidentList.cs20
-rw-r--r--ApartmentManager/HousingWebApi/Models/User.cs41
-rw-r--r--ApartmentManager/HousingWebApi/Web.config5
-rw-r--r--Diagrams/DCD.vsdxbin0 -> 109929 bytes
-rw-r--r--Diagrams/DatabaseDiagram.vsdxbin65102 -> 64594 bytes
-rw-r--r--Diagrams/Domain Model.vsdxbin38859 -> 36471 bytes
53 files changed, 1795 insertions, 432 deletions
diff --git a/ApartmentManager/ApartmentManager/ApartmentManager.csproj b/ApartmentManager/ApartmentManager/ApartmentManager.csproj
index b2ed700..373b8f7 100644
--- a/ApartmentManager/ApartmentManager/ApartmentManager.csproj
+++ b/ApartmentManager/ApartmentManager/ApartmentManager.csproj
@@ -123,6 +123,9 @@
<Compile Include="View\ApartmentDefectPage.xaml.cs">
<DependentUpon>ApartmentDefectPage.xaml</DependentUpon>
</Compile>
+ <Compile Include="View\ApartmentDefectViewPagexaml.xaml.cs">
+ <DependentUpon>ApartmentDefectViewPagexaml.xaml</DependentUpon>
+ </Compile>
<Compile Include="View\ApartmentNewDefect.xaml.cs">
<DependentUpon>ApartmentNewDefect.xaml</DependentUpon>
</Compile>
@@ -193,6 +196,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="View\ApartmentDefectViewPagexaml.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="View\ApartmentNewDefect.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
diff --git a/ApartmentManager/ApartmentManager/AppShell.xaml.cs b/ApartmentManager/ApartmentManager/AppShell.xaml.cs
index 746f61e..dec5cf7 100644
--- a/ApartmentManager/ApartmentManager/AppShell.xaml.cs
+++ b/ApartmentManager/ApartmentManager/AppShell.xaml.cs
@@ -102,7 +102,7 @@ namespace ApartmentManager
{
InitializeComponent();
- if (UserSingleton.Instance.CurrentUser.Type == "B") navMenuItems = boardMemberMenuItems;
+ if (UserSingleton.Instance.CurrentUser.IsBm) navMenuItems = boardMemberMenuItems;
else navMenuItems = normalUserMenuItems;
List<NavMenuItem> topNavMenuItems = navMenuItems.GetRange(0, navMenuItems.Count);
diff --git a/ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs b/ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs
index f3cc8b3..ded9732 100644
--- a/ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs
+++ b/ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs
@@ -23,9 +23,9 @@ namespace ApartmentManager.Handler
public void GetApartmentResidents()
{
Resident resident = new Resident();
- resident.ApartmentNr = ApartmentViewModel.ApartmentNumber;
+ resident.ApartmentId = ApartmentViewModel.ApartmentNumber;
- var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentNr);
+ var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentId);
IEnumerable<Resident> residentlist = JsonConvert.DeserializeObject<IEnumerable<Resident>>(residentsFromDatabase);
ApartmentViewModel.CatalogSingleton.Residents.Clear();
@@ -49,7 +49,7 @@ namespace ApartmentManager.Handler
try
{
Resident resident = new Resident();
- resident.ApartmentNr = ApartmentViewModel.ApartmentNumber;
+ resident.ApartmentId = ApartmentViewModel.ApartmentNumber;
resident.FirstName = ApartmentViewModel.NewResident.FirstName;
resident.LastName = ApartmentViewModel.NewResident.LastName;
resident.BirthDate = ApartmentViewModel.NewResident.BirthDate;
@@ -59,7 +59,7 @@ namespace ApartmentManager.Handler
ApiClient.PostData("api/residents/", resident);
- var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentNr);
+ var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentId);
IEnumerable<Resident> residentlist = JsonConvert.DeserializeObject<IEnumerable<Resident>>(residentsFromDatabase);
ApartmentViewModel.CatalogSingleton.Residents.Clear();
@@ -80,8 +80,8 @@ namespace ApartmentManager.Handler
try
{
Resident resident = new Resident();
- resident.ResidentNr = ApartmentViewModel.NewResident.ResidentNr;
- resident.ApartmentNr = ApartmentViewModel.ApartmentNumber;
+ resident.ResidentId = ApartmentViewModel.NewResident.ResidentId;
+ resident.ApartmentId = ApartmentViewModel.ApartmentNumber;
resident.FirstName = ApartmentViewModel.NewResident.FirstName;
resident.LastName = ApartmentViewModel.NewResident.LastName;
resident.BirthDate = ApartmentViewModel.NewResident.BirthDate;
@@ -89,9 +89,9 @@ namespace ApartmentManager.Handler
resident.Picture = ApartmentViewModel.NewResident.Picture;
resident.Phone = ApartmentViewModel.NewResident.Phone;
- ApiClient.DeleteData("api/residents/" + resident.ResidentNr);
+ ApiClient.DeleteData("api/residents/" + resident.ResidentId);
- var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentNr);
+ var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentId);
IEnumerable<Resident> residentlist = JsonConvert.DeserializeObject<IEnumerable<Resident>>(residentsFromDatabase);
ApartmentViewModel.CatalogSingleton.Residents.Clear();
@@ -111,8 +111,8 @@ namespace ApartmentManager.Handler
try
{
Resident resident = new Resident();
- resident.ResidentNr = ApartmentViewModel.NewResident.ResidentNr;
- resident.ApartmentNr = ApartmentViewModel.ApartmentNumber;
+ resident.ResidentId = ApartmentViewModel.NewResident.ResidentId;
+ resident.ApartmentId = ApartmentViewModel.ApartmentNumber;
resident.FirstName = ApartmentViewModel.NewResident.FirstName;
resident.LastName = ApartmentViewModel.NewResident.LastName;
resident.BirthDate = ApartmentViewModel.NewResident.BirthDate;
@@ -120,8 +120,8 @@ namespace ApartmentManager.Handler
resident.Picture = ApartmentViewModel.NewResident.Picture;
resident.Phone = ApartmentViewModel.NewResident.Phone;
- ApiClient.PutData("api/residents/" + resident.ResidentNr, resident);
- var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentNr);
+ ApiClient.PutData("api/residents/" + resident.ResidentId, resident);
+ var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentId);
IEnumerable<Resident> residentlist = JsonConvert.DeserializeObject<IEnumerable<Resident>>(residentsFromDatabase);
ApartmentViewModel.CatalogSingleton.Residents.Clear();
@@ -141,7 +141,7 @@ namespace ApartmentManager.Handler
{
try
{
- ApartmentViewModel.NewResident.Picture = await ImgurPhotoUploader.UploadPhotoAsync();
+ //ApartmentViewModel.NewResident.Picture = await ImgurPhotoUploader.UploadPhotoAsync();
var tmp = ApartmentViewModel.NewResident;
ApartmentViewModel.NewResident = new Resident();
ApartmentViewModel.NewResident = tmp;
diff --git a/ApartmentManager/ApartmentManager/Handler/BoardMemberHandler.cs b/ApartmentManager/ApartmentManager/Handler/BoardMemberHandler.cs
index db6223d..c642b02 100644
--- a/ApartmentManager/ApartmentManager/Handler/BoardMemberHandler.cs
+++ b/ApartmentManager/ApartmentManager/Handler/BoardMemberHandler.cs
@@ -25,7 +25,7 @@ namespace ApartmentManager.Handler
public void GetApartments()
{
Apartment apartment= new Apartment();
- apartment.ApartmentNumber = BoardMemberViewModel.ApartmentsNumber;
+ apartment.ApartmentId = BoardMemberViewModel.ApartmentsNumber;
var apartmentsFromDatabase = ApiClient.GetData("api/Apartments/");
IEnumerable<Apartment> apartmentslist = JsonConvert.DeserializeObject<IEnumerable<Apartment>>(apartmentsFromDatabase);
@@ -43,7 +43,7 @@ namespace ApartmentManager.Handler
try
{
Apartment apartment = new Apartment();
- apartment.ApartmentNumber = BoardMemberViewModel.ApartmentsNumber;
+ apartment.ApartmentId = BoardMemberViewModel.ApartmentsNumber;
apartment.Address = BoardMemberViewModel.NewApartment.Address;
apartment.Floor = BoardMemberViewModel.NewApartment.Floor;
apartment.MonthlyCharge = BoardMemberViewModel.NewApartment.MonthlyCharge;
@@ -52,7 +52,7 @@ namespace ApartmentManager.Handler
ApiClient.PostData("api/Apartments/", apartment);
- var apartmentsFromDatabase = ApiClient.GetData("api/Apartments/" + apartment.ApartmentNumber);
+ var apartmentsFromDatabase = ApiClient.GetData("api/Apartments/" + apartment.ApartmentId);
IEnumerable<Apartment> apartmentlist = JsonConvert.DeserializeObject<IEnumerable<Apartment>>(apartmentsFromDatabase);
BoardMemberViewModel.BoardMemberCatalogSingleton.Apartment.Clear();
@@ -72,15 +72,15 @@ namespace ApartmentManager.Handler
try
{
Apartment apartment = new Apartment();
- apartment.ApartmentNumber = BoardMemberViewModel.ApartmentsNumber;
+ apartment.ApartmentId = BoardMemberViewModel.ApartmentsNumber;
apartment.Address = BoardMemberViewModel.NewApartment.Address;
apartment.Floor = BoardMemberViewModel.NewApartment.Floor;
apartment.MonthlyCharge = BoardMemberViewModel.NewApartment.MonthlyCharge;
apartment.NumberOfRooms = BoardMemberViewModel.NewApartment.NumberOfRooms;
apartment.Size = BoardMemberViewModel.NewApartment.Size;
- ApiClient.PutData("api/Apartments/" + apartment.ApartmentNumber, apartment);
- var apartmentsFromDatabase = ApiClient.GetData("api/Apartments/" + apartment.ApartmentNumber);
+ ApiClient.PutData("api/Apartments/" + apartment.ApartmentId, apartment);
+ var apartmentsFromDatabase = ApiClient.GetData("api/Apartments/" + apartment.ApartmentId);
IEnumerable<Apartment> apartmentslist = JsonConvert.DeserializeObject<IEnumerable<Apartment>>(apartmentsFromDatabase);
BoardMemberViewModel.BoardMemberCatalogSingleton.Apartment.Clear();
@@ -100,16 +100,16 @@ namespace ApartmentManager.Handler
try
{
Apartment apartment = new Apartment();
- apartment.ApartmentNumber = BoardMemberViewModel.ApartmentsNumber;
+ apartment.ApartmentId = BoardMemberViewModel.ApartmentsNumber;
apartment.Address = BoardMemberViewModel.NewApartment.Address;
apartment.Floor = BoardMemberViewModel.NewApartment.Floor;
apartment.MonthlyCharge = BoardMemberViewModel.NewApartment.MonthlyCharge;
apartment.NumberOfRooms = BoardMemberViewModel.NewApartment.NumberOfRooms;
apartment.Size = BoardMemberViewModel.NewApartment.Size;
- ApiClient.DeleteData("api/Apartments/" + apartment.ApartmentNumber);
+ ApiClient.DeleteData("api/Apartments/" + apartment.ApartmentId);
- var apartmentsFromDatabase = ApiClient.GetData("api/Apartments/" + apartment.ApartmentNumber);
+ var apartmentsFromDatabase = ApiClient.GetData("api/Apartments/" + apartment.ApartmentId);
IEnumerable<Apartment> apartmentslist = JsonConvert.DeserializeObject<IEnumerable<Apartment>>(apartmentsFromDatabase);
BoardMemberViewModel.BoardMemberCatalogSingleton.Apartment.Clear();
diff --git a/ApartmentManager/ApartmentManager/Handler/BoardResidentsHandler.cs b/ApartmentManager/ApartmentManager/Handler/BoardResidentsHandler.cs
index b012ce1..3f6086e 100644
--- a/ApartmentManager/ApartmentManager/Handler/BoardResidentsHandler.cs
+++ b/ApartmentManager/ApartmentManager/Handler/BoardResidentsHandler.cs
@@ -22,9 +22,9 @@ namespace ApartmentManager.Handler
public void GetApartmentsResidents()
{
Resident resident = new Resident();
- resident.ApartmentNr = BoardMemberViewModel.ApartmentsNumber;
+ resident.ApartmentId = BoardMemberViewModel.ApartmentsNumber;
- var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentNr);
+ var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentId);
IEnumerable<Resident> residentlist = JsonConvert.DeserializeObject<IEnumerable<Resident>>(residentsFromDatabase);
BoardMemberViewModel.BoardMemberCatalogSingleton.Residents.Clear();
@@ -41,7 +41,7 @@ namespace ApartmentManager.Handler
{
Resident resident = new Resident();
- resident.ApartmentNr = BoardMemberViewModel.ApartmentsNumber;
+ resident.ApartmentId = BoardMemberViewModel.ApartmentsNumber;
resident.FirstName = BoardMemberViewModel.NewResident.FirstName;
resident.LastName = BoardMemberViewModel.NewResident.LastName;
resident.BirthDate = BoardMemberViewModel.NewResident.BirthDate;
@@ -51,7 +51,7 @@ namespace ApartmentManager.Handler
ApiClient.PostData("api/residents/", resident);
- var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentNr);
+ var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentId);
IEnumerable<Resident> residentlist = JsonConvert.DeserializeObject<IEnumerable<Resident>>(residentsFromDatabase);
BoardMemberViewModel.BoardMemberCatalogSingleton.Residents.Clear();
@@ -72,8 +72,8 @@ namespace ApartmentManager.Handler
try
{
Resident resident = new Resident();
- resident.ResidentNr = BoardMemberViewModel.NewResident.ResidentNr;
- resident.ApartmentNr = BoardMemberViewModel.ApartmentsNumber;
+ resident.ResidentId = BoardMemberViewModel.NewResident.ResidentId;
+ resident.ApartmentId = BoardMemberViewModel.ApartmentsNumber;
resident.FirstName = BoardMemberViewModel.NewResident.FirstName;
resident.LastName = BoardMemberViewModel.NewResident.LastName;
resident.BirthDate = BoardMemberViewModel.NewResident.BirthDate;
@@ -81,9 +81,9 @@ namespace ApartmentManager.Handler
resident.Picture = BoardMemberViewModel.NewResident.Picture;
resident.Phone = BoardMemberViewModel.NewResident.Phone;
- ApiClient.DeleteData("api/residents/" + resident.ResidentNr);
+ ApiClient.DeleteData("api/residents/" + resident.ResidentId);
- var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentNr);
+ var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentId);
IEnumerable<Resident> residentlist = JsonConvert.DeserializeObject<IEnumerable<Resident>>(residentsFromDatabase);
BoardMemberViewModel.BoardMemberCatalogSingleton.Residents.Clear();
@@ -103,8 +103,8 @@ namespace ApartmentManager.Handler
try
{
Resident resident = new Resident();
- resident.ResidentNr = BoardMemberViewModel.NewResident.ResidentNr;
- resident.ApartmentNr = BoardMemberViewModel.ApartmentsNumber;
+ resident.ResidentId = BoardMemberViewModel.NewResident.ResidentId;
+ resident.ApartmentId = BoardMemberViewModel.ApartmentsNumber;
resident.FirstName = BoardMemberViewModel.NewResident.FirstName;
resident.LastName = BoardMemberViewModel.NewResident.LastName;
resident.BirthDate = BoardMemberViewModel.NewResident.BirthDate;
@@ -112,8 +112,8 @@ namespace ApartmentManager.Handler
resident.Picture = BoardMemberViewModel.NewResident.Picture;
resident.Phone = BoardMemberViewModel.NewResident.Phone;
- ApiClient.PutData("api/residents/" + resident.ResidentNr, resident);
- var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentNr);
+ ApiClient.PutData("api/residents/" + resident.ResidentId, resident);
+ var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentId);
IEnumerable<Resident> residentlist = JsonConvert.DeserializeObject<IEnumerable<Resident>>(residentsFromDatabase);
BoardMemberViewModel.BoardMemberCatalogSingleton.Residents.Clear();
diff --git a/ApartmentManager/ApartmentManager/Handler/LoginHandler.cs b/ApartmentManager/ApartmentManager/Handler/LoginHandler.cs
index 4cf5fed..e952e0b 100644
--- a/ApartmentManager/ApartmentManager/Handler/LoginHandler.cs
+++ b/ApartmentManager/ApartmentManager/Handler/LoginHandler.cs
@@ -9,7 +9,7 @@ namespace ApartmentManager.Handler
{
public static void LogIn(string username, string password)
{
- string serializedUser = ApiClient.GetData($"api/Users/by-username/{username}");
+ string serializedUser = ApiClient.GetData($"api/Users/{username}");
if (serializedUser != null)
{
User user = JsonConvert.DeserializeObject<User>(serializedUser);
diff --git a/ApartmentManager/ApartmentManager/Model/Apartment.cs b/ApartmentManager/ApartmentManager/Model/Apartment.cs
index 92f1501..06b427d 100644
--- a/ApartmentManager/ApartmentManager/Model/Apartment.cs
+++ b/ApartmentManager/ApartmentManager/Model/Apartment.cs
@@ -1,33 +1,25 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace ApartmentManager.Model
+namespace ApartmentManager.Model
{
public class Apartment
{
- public int ApartmentNumber { get; set; }
- public string Size { get; set; }
- public int NumberOfRooms { get; set; }
- public string MonthlyCharge { get; set; }
- public int Floor { get; set; }
+ public int ApartmentId { get; set; }
+ public double? Size { get; set; }
+ public int? NumberOfRooms { get; set; }
+ public double? MonthlyCharge { get; set; }
+ public int? Floor { get; set; }
public string Address { get; set; }
- public string PlanPicture { get; set; }
+ public byte[] PlanPicture { get; set; }
public Apartment() { }
- public Apartment(int ApartmentNumber, string Size,int NumberOfRooms,string MonthlyCharge,int Floor, string Address)
+ public Apartment(int apartmentId, double? size, int? numberOfRooms, double? monthlyCharge, int? floor, string address)
{
- this.ApartmentNumber = ApartmentNumber;
- this.Size = Size;
- this.NumberOfRooms = NumberOfRooms;
- this.MonthlyCharge = MonthlyCharge;
- this.Floor = Floor;
- this.Address = Address;
-
-
+ ApartmentId = apartmentId;
+ Size = size;
+ NumberOfRooms = numberOfRooms;
+ MonthlyCharge = monthlyCharge;
+ Floor = floor;
+ Address = address;
}
//public override string ToString()
@@ -39,10 +31,7 @@ namespace ApartmentManager.Model
public override string ToString()
{
- return string.Format(
- $"Apartment No: {ApartmentNumber} Size: {Size} NoOfRooms: {NumberOfRooms}" +
- $" MonthlyCharge: {MonthlyCharge} Floor: {Floor} Address {Address}"
- );
+ return string.Format($"Apartment number: {ApartmentId}, Size: {Size} Number of rooms: {NumberOfRooms}, Monthly charge: {MonthlyCharge}, Floor: {Floor}, Address: {Address}");
}
}
}
diff --git a/ApartmentManager/ApartmentManager/Model/Defect.cs b/ApartmentManager/ApartmentManager/Model/Defect.cs
index 5d97831..afb29e2 100644
--- a/ApartmentManager/ApartmentManager/Model/Defect.cs
+++ b/ApartmentManager/ApartmentManager/Model/Defect.cs
@@ -1,43 +1,30 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Windows.UI.Xaml.Controls;
namespace ApartmentManager.Model
{
public class Defect
{
- public int DefectNumber { get; set; }
- public int ApartmentNumber { get; set; }
+ public int DefectId { get; set; }
+ public int ApartmentId { get; set; }
public string Name { get; set; }
- public DateTime DateUploaded { get; set; }
- public string Picture { get; set; }
- public string Picture2 { get; set; }
- public string Picture3 { get; set; }
- public string Description { get; set; }
- public string Comment { get; set; }
+ public DateTime? UploadDate { get; set; }
+ public string Description { get; set; }
public string Status { get; set; }
public Defect() { }
- public Defect( int ApartmentNumber, string Name, DateTime DateUploaded, string Picture, string Picture2, string Picture3, string Description, string Comment, string Status)
+ public Defect(int defectId, int apartmentId, string name, DateTime? uploadDate, string description, string status)
{
-
- this.ApartmentNumber = ApartmentNumber;
- this.Name = Name;
- this.DateUploaded = DateUploaded;
- this.Picture = Picture;
- this.Picture2 = Picture2;
- this.Picture3 = Picture3;
- this.Description = Description;
- this.Comment = Comment;
- this.Status = Status;
+ DefectId = defectId;
+ ApartmentId = apartmentId;
+ Name = name;
+ UploadDate = uploadDate;
+ Description = description;
+ Status = status;
}
public override string ToString()
{
- return string.Format($"Defect Number: {DefectNumber}, Apartment Number: {ApartmentNumber}, Name: {Name}, Date Uploaded {DateUploaded}, {Picture}, {Picture2}, {Picture3}, Description: {Description}, Comment: {Comment}, Status: {Status}");
+ return string.Format($"Defect ID: {DefectId}, Apartment number: {ApartmentId}, Name: {Name}, Upload date: {UploadDate}, Description: {Description}, Status: {Status}");
}
}
}
diff --git a/ApartmentManager/ApartmentManager/Model/Resident.cs b/ApartmentManager/ApartmentManager/Model/Resident.cs
index 79bf6a1..d897d4b 100644
--- a/ApartmentManager/ApartmentManager/Model/Resident.cs
+++ b/ApartmentManager/ApartmentManager/Model/Resident.cs
@@ -1,42 +1,35 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Windows.UI.Xaml.Controls;
namespace ApartmentManager.Model
{
public class Resident
{
+ public int ResidentId { get; set; }
+ public int ApartmentId { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
- public int Phone { get; set; }
- public DateTimeOffset BirthDate { get; set; }
+ public DateTime? BirthDate { get; set; }
+ public string Phone { get; set; }
public string Email { get; set; }
- public string Picture { get; set; }
- public int ApartmentNr { get; set; }
- public int ResidentNr { get; set; }
+ public byte[] Picture { get; set; }
public Resident()
{
- Picture = "https://tracker.moodle.org/secure/attachment/30912/f3.png";
- BirthDate = DateTimeOffset.Now;
+ BirthDate = DateTime.Now;
}
- public Resident(string firstName, string lastName, int phone, DateTimeOffset birthDate, string email, int apartmentNr ,int residentNr, string picture)
+ public Resident(int residentId, int apartmentId, string firstName, string lastName, DateTime birthDate, string phone, string email)
{
+ ResidentId = residentId;
+ ApartmentId = apartmentId;
FirstName = firstName;
LastName = lastName;
- Phone = phone;
BirthDate = birthDate;
+ Phone = phone;
Email = email;
- ApartmentNr = apartmentNr;
- ResidentNr = residentNr;
- Picture = picture;
}
public override string ToString()
{
- return string.Format($"Name: {FirstName}, LastName: {LastName}, Birth Date: {BirthDate.Date}, Phone {Phone}, Email {Email} ");
+ return string.Format($"First name: {FirstName}, Last name: {LastName}, Birth date: {BirthDate.Value.Date}, Phone: {Phone}, Email: {Email} ");
}
}
}
diff --git a/ApartmentManager/ApartmentManager/Model/User.cs b/ApartmentManager/ApartmentManager/Model/User.cs
index 65fd778..e506791 100644
--- a/ApartmentManager/ApartmentManager/Model/User.cs
+++ b/ApartmentManager/ApartmentManager/Model/User.cs
@@ -9,34 +9,28 @@ namespace ApartmentManager.Model
{
public class User
{
- public int ApartmentNr { get; set; }
public string Username { get; set; }
+ public int ApartmentId { get; set; }
public string Password { get; set; }
- public string Type { get; set; }
+ public bool IsBm { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
- public DateTime BirthDate { get; set; }
+ public DateTime? BirthDate { get; set; }
public string Phone { get; set; }
public string Email { get; set; }
- public Image Picture { get; set; }
- public string SecondName { get; set; }
- public string SecondLastName { get; set; }
- public string SecondBirthDate { get; set; }
- public string SecondPhone { get; set; }
- public string SecondEmail { get; set; }
-
+ public byte[] Picture { get; set; }
+ public DateTime? MoveInDate { get; set; }
+ public DateTime? MoveOutDate { get; set; }
public User() { }
- public User(string FirstName, string LastName, string Phone, DateTime BirthDate, string Email, int ApartmentNr)
+ public User(string FirstName, string LastName, string Phone, DateTime? BirthDate, string Email, int ApartmentNr)
{
this.FirstName = FirstName;
this.LastName = LastName;
- this.Phone = Phone;
this.BirthDate = BirthDate;
+ this.Phone = Phone;
this.Email = Email;
- this.ApartmentNr = ApartmentNr;
-
}
public override string ToString()
diff --git a/ApartmentManager/ApartmentManager/Persistency/PersistenceFacade.cs b/ApartmentManager/ApartmentManager/Persistency/PersistenceFacade.cs
index 4948e7d..3a6f85e 100644
--- a/ApartmentManager/ApartmentManager/Persistency/PersistenceFacade.cs
+++ b/ApartmentManager/ApartmentManager/Persistency/PersistenceFacade.cs
@@ -65,7 +65,7 @@ namespace ApartmentManager.Persistency
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
try
{
- string residentsBody = "api/residents/" + resident.ApartmentNr;
+ string residentsBody = "api/residents/" + resident.ApartmentId;
var response = client.GetAsync(residentsBody).Result;
if (response.IsSuccessStatusCode)
diff --git a/ApartmentManager/ApartmentManager/Singletons/CatalogSingleton.cs b/ApartmentManager/ApartmentManager/Singletons/CatalogSingleton.cs
index 490ac49..95f2323 100644
--- a/ApartmentManager/ApartmentManager/Singletons/CatalogSingleton.cs
+++ b/ApartmentManager/ApartmentManager/Singletons/CatalogSingleton.cs
@@ -18,13 +18,10 @@ namespace ApartmentManager.Singletons
{
Residents = new ObservableCollection<Resident>();
Defects = new ObservableCollection<Defect>();
- Defects.Add(new Defect(1, "Broken Pipe", new DateTime(1988, 8, 8), "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "description", "comment", "status"));
- Defects.Add(new Defect(1, "Broken Pipe", new DateTime(1988, 8, 8), "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "description", "comment", "status"));
- Defects.Add(new Defect(1, "Broken Pipe", new DateTime(1988, 8, 8), "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "description", "comment", "status"));
- Defects.Add(new Defect(1, "Broken Pipe", new DateTime(1988, 8, 8), "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "description", "comment", "status"));
-
- Defects.Add(new Defect(1, "Broken Pipe", new DateTime(1988, 8, 8), "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "description", "comment", "status"));
-
+ Defects.Add(new Defect(1, 1, "Broken Pipe", new DateTime(1988, 8, 8), "description", "status"));
+ Defects.Add(new Defect(1, 1, "Broken Pipe", new DateTime(1988, 8, 8), "description", "status"));
+ Defects.Add(new Defect(1, 1, "Broken Pipe", new DateTime(1988, 8, 8), "description", "status"));
+ Defects.Add(new Defect(1, 1, "Broken Pipe", new DateTime(1988, 8, 8), "description", "status"));
}
}
}
diff --git a/ApartmentManager/ApartmentManager/View/ApartmentDefectPage.xaml b/ApartmentManager/ApartmentManager/View/ApartmentDefectPage.xaml
index a69fe96..c73065f 100644
--- a/ApartmentManager/ApartmentManager/View/ApartmentDefectPage.xaml
+++ b/ApartmentManager/ApartmentManager/View/ApartmentDefectPage.xaml
@@ -65,7 +65,7 @@
</ListView.ItemTemplate>
</ListView>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,15,0,0">
- <Button Content="New Defect" Width="200" Margin="0,0,100,0" ></Button>
+ <Button Content="New Defect" Width="200" Margin="0,0,100,0" Click="NavigateNewDefect" ></Button>
<Button Content="View Defect" Width="200" Margin="0,0,100,0" ></Button>
</StackPanel>
diff --git a/ApartmentManager/ApartmentManager/View/ApartmentDefectPage.xaml.cs b/ApartmentManager/ApartmentManager/View/ApartmentDefectPage.xaml.cs
index 7a157ab..eef6323 100644
--- a/ApartmentManager/ApartmentManager/View/ApartmentDefectPage.xaml.cs
+++ b/ApartmentManager/ApartmentManager/View/ApartmentDefectPage.xaml.cs
@@ -26,5 +26,10 @@ namespace ApartmentManager.View
{
this.InitializeComponent();
}
+
+ private void NavigateNewDefect(object sender, RoutedEventArgs e)
+ {
+ Frame.Navigate(typeof(ApartmentNewDefect));
+ }
}
}
diff --git a/ApartmentManager/ApartmentManager/View/ApartmentDefectViewPagexaml.xaml b/ApartmentManager/ApartmentManager/View/ApartmentDefectViewPagexaml.xaml
new file mode 100644
index 0000000..42c48a2
--- /dev/null
+++ b/ApartmentManager/ApartmentManager/View/ApartmentDefectViewPagexaml.xaml
@@ -0,0 +1,37 @@
+<Page
+ x:Class="ApartmentManager.View.ApartmentDefectViewPagexaml"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:local="using:ApartmentManager.View"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ mc:Ignorable="d">
+
+ <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
+ <StackPanel>
+ <StackPanel Orientation="Horizontal" Margin="10,10,10,0">
+ <TextBlock Text="Name:" FontSize="30" FontWeight="Bold" Margin="100,0,0,0"></TextBlock>
+ <TextBlock Text="Defect Name" FontSize="30" FontWeight="Bold" Margin="10,0,0,0"></TextBlock>
+ <TextBlock Text="Status:" FontSize="30" FontWeight="Bold" Margin="400,0,0,0"></TextBlock>
+ <TextBlock Text="Defect Status" FontSize="30" FontWeight="Bold" Margin="10,0,0,0"></TextBlock>
+ </StackPanel>
+ <StackPanel Orientation="Horizontal" Margin="20">
+ <StackPanel Width="620">
+ <TextBlock Text="Defect Pictures" FontSize="30" FontWeight="Bold" Margin="10,0,0,0"></TextBlock>
+ <ListView ></ListView>
+ </StackPanel>
+ <StackPanel Width="620">
+ <TextBlock Text="Description" FontSize="30" FontWeight="Bold" Margin="10,0,0,0"></TextBlock>
+ <TextBox Height="400" Margin="0,10,0,0"></TextBox>
+
+ </StackPanel>
+
+
+ </StackPanel>
+ <ListView Width="600" Height="200"></ListView>
+
+
+
+ </StackPanel>
+ </Grid>
+</Page>
diff --git a/ApartmentManager/ApartmentManager/View/ApartmentDefectViewPagexaml.xaml.cs b/ApartmentManager/ApartmentManager/View/ApartmentDefectViewPagexaml.xaml.cs
new file mode 100644
index 0000000..beffd9c
--- /dev/null
+++ b/ApartmentManager/ApartmentManager/View/ApartmentDefectViewPagexaml.xaml.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Controls;
+using Windows.UI.Xaml.Controls.Primitives;
+using Windows.UI.Xaml.Data;
+using Windows.UI.Xaml.Input;
+using Windows.UI.Xaml.Media;
+using Windows.UI.Xaml.Navigation;
+
+// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
+
+namespace ApartmentManager.View
+{
+ /// <summary>
+ /// An empty page that can be used on its own or navigated to within a Frame.
+ /// </summary>
+ public sealed partial class ApartmentDefectViewPagexaml : Page
+ {
+ public ApartmentDefectViewPagexaml()
+ {
+ this.InitializeComponent();
+ }
+ }
+}
diff --git a/ApartmentManager/ApartmentManager/View/ApartmentNewDefect.xaml b/ApartmentManager/ApartmentManager/View/ApartmentNewDefect.xaml
index c6332e1..770a132 100644
--- a/ApartmentManager/ApartmentManager/View/ApartmentNewDefect.xaml
+++ b/ApartmentManager/ApartmentManager/View/ApartmentNewDefect.xaml
@@ -21,19 +21,12 @@
<StackPanel Margin="0,5,30,0">
<StackPanel Orientation="Horizontal" >
- <Image Height="200" Width="355" Source="{Binding NewDefect.Picture}" />
<Button Content="Upload Picture" Margin="30,0,0,0"/>
</StackPanel>
- <StackPanel Orientation="Horizontal" Margin="0,30,0,0">
- <Image Height="200" Width="355" Source="{Binding NewDefect.Picture2}" />
- <Button Content="Upload Picture" Margin="30,0,0,0"/>
- </StackPanel>
+ <StackPanel Orientation="Horizontal" Margin="0,30,0,0"/>
- <StackPanel Orientation="Horizontal" Margin="0,30,0,0">
- <Image Height="200" Width="355" Source="{Binding NewDefect.Picture3}" />
- <Button Content="Upload Picture" Margin="30,0,0,0"/>
- </StackPanel>
+ <StackPanel Orientation="Horizontal" Margin="0,30,0,0"/>
</StackPanel>
@@ -41,9 +34,7 @@
<TextBlock Margin="0,10,0,10" Text="Name"/>
<TextBox Text="{Binding NewDefect.Name, Mode=TwoWay}" />
<TextBlock Margin="0,10,0,10" Text="Description"/>
- <TextBox Text="{Binding NewDefect.Description, Mode=TwoWay}" Height="140" />
- <TextBlock Margin="0,10,0,10" Text="Comment"/>
- <TextBox Text="{Binding NewDefect.Comment, Mode=TwoWay}" Height="300" />
+ <TextBox Text="{Binding NewDefect.Description, Mode=TwoWay}" Height="417" />
<Button Margin="0,20,0,0" Content="Create" HorizontalAlignment="Stretch"/>
</StackPanel>
diff --git a/ApartmentManager/ApartmentManager/View/ApartmentResidentsPage.xaml.cs b/ApartmentManager/ApartmentManager/View/ApartmentResidentsPage.xaml.cs
index b90815c..b1272bb 100644
--- a/ApartmentManager/ApartmentManager/View/ApartmentResidentsPage.xaml.cs
+++ b/ApartmentManager/ApartmentManager/View/ApartmentResidentsPage.xaml.cs
@@ -27,10 +27,5 @@ namespace ApartmentManager.View
{
this.InitializeComponent();
}
-
- private void OpenFilePicker(object sender, RoutedEventArgs e)
- {
-
- }
}
}
diff --git a/ApartmentManager/ApartmentManager/View/LoginPage.xaml b/ApartmentManager/ApartmentManager/View/LoginPage.xaml
index fc9c463..c6085b9 100644
--- a/ApartmentManager/ApartmentManager/View/LoginPage.xaml
+++ b/ApartmentManager/ApartmentManager/View/LoginPage.xaml
@@ -18,7 +18,7 @@
<TextBox Text="{Binding Username, Mode=TwoWay}"/>
<TextBlock Margin="0,10,0,10" Text="Password"/>
<PasswordBox Password="{Binding Password, Mode=TwoWay}"/>
- <Button x:Name="LogInButton" Margin="0,10,0,10" Content="Log In" HorizontalAlignment="Stretch" Command="{Binding LogInCommand}" Click="LogInButton_Click"/>
+ <Button x:Name="LogInButton" Margin="0,10,0,10" Content="Log In" HorizontalAlignment="Stretch" Command="{Binding LogInCommand}"/>
</StackPanel>
</Grid>
</Page>
diff --git a/ApartmentManager/ApartmentManager/View/LoginPage.xaml.cs b/ApartmentManager/ApartmentManager/View/LoginPage.xaml.cs
index 73d6bd7..be71f0a 100644
--- a/ApartmentManager/ApartmentManager/View/LoginPage.xaml.cs
+++ b/ApartmentManager/ApartmentManager/View/LoginPage.xaml.cs
@@ -12,10 +12,5 @@ namespace ApartmentManager.View
{
this.InitializeComponent();
}
-
- private void LogInButton_Click(object sender, RoutedEventArgs e)
- {
-
- }
}
}
diff --git a/ApartmentManager/ApartmentManager/ViewModel/BoardMemberViewModel.cs b/ApartmentManager/ApartmentManager/ViewModel/BoardMemberViewModel.cs
index 293e4bf..fc2c838 100644
--- a/ApartmentManager/ApartmentManager/ViewModel/BoardMemberViewModel.cs
+++ b/ApartmentManager/ApartmentManager/ViewModel/BoardMemberViewModel.cs
@@ -44,7 +44,7 @@ namespace ApartmentManager.ViewModel
BoardMemberHandler = new Handler.BoardMemberHandler(this);
BoardMemberCatalogSingleton = BoardMemberCatalogSingleton.Instance;
UserSingleton = UserSingleton.Instance;
- ApartmentsNumber = UserSingleton.CurrentUser.ApartmentNr;
+ ApartmentsNumber = UserSingleton.CurrentUser.ApartmentId;
CreateApartmentCommand = new RelayCommand(BoardMemberHandler.CreateApartment);
DeleteApartmentCommand = new RelayCommand(BoardMemberHandler.DeleteApartment);
diff --git a/ApartmentManager/ApartmentManager/ViewModel/LoginViewModel.cs b/ApartmentManager/ApartmentManager/ViewModel/LoginViewModel.cs
index ff50a42..5f3c1b7 100644
--- a/ApartmentManager/ApartmentManager/ViewModel/LoginViewModel.cs
+++ b/ApartmentManager/ApartmentManager/ViewModel/LoginViewModel.cs
@@ -14,7 +14,6 @@ namespace ApartmentManager.ViewModel
{
public static string Username { get; set; }
public static string Password { get; set; }
- public bool IsPasswordCorrect { get; set; }
public ICommand LogInCommand { get; set; }
public ICommand LogOutCommand { get; set; }
@@ -69,7 +68,7 @@ namespace ApartmentManager.ViewModel
{
// When the navigation stack isn't restored, navigate to the first page
// suppressing the initial entrance animation.
- if (UserSingleton.Instance.CurrentUser.Type == "B") appShell.AppFrame.Navigate(typeof(BoardMembersMainPage));
+ if (UserSingleton.Instance.CurrentUser.IsBm) appShell.AppFrame.Navigate(typeof(BoardMembersMainPage));
else appShell.AppFrame.Navigate(typeof(ApartmentPage));
}
diff --git a/ApartmentManager/HousingWebAPI/Models/database_firewall_rules.cs b/ApartmentManager/HousingWebAPI/Models/database_firewall_rules.cs
deleted file mode 100644
index 3b5d6a5..0000000
--- a/ApartmentManager/HousingWebAPI/Models/database_firewall_rules.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-namespace HousingWebApi
-{
- using System;
- using System.Collections.Generic;
- using System.ComponentModel.DataAnnotations;
- using System.ComponentModel.DataAnnotations.Schema;
- using System.Data.Entity.Spatial;
-
- [Table("sys.database_firewall_rules")]
- public partial class database_firewall_rules
- {
- [Key]
- [Column(Order = 0)]
- public int id { get; set; }
-
- [Key]
- [Column(Order = 1)]
- public string name { get; set; }
-
- [Key]
- [Column(Order = 2)]
- [StringLength(45)]
- public string start_ip_address { get; set; }
-
- [Key]
- [Column(Order = 3)]
- [StringLength(45)]
- public string end_ip_address { get; set; }
-
- [Key]
- [Column(Order = 4)]
- public DateTime create_date { get; set; }
-
- [Key]
- [Column(Order = 5)]
- public DateTime modify_date { get; set; }
- }
-}
diff --git a/ApartmentManager/HousingWebApi/Controllers/AllResidentsController.cs b/ApartmentManager/HousingWebApi/Controllers/AllResidentsController.cs
new file mode 100644
index 0000000..046a385
--- /dev/null
+++ b/ApartmentManager/HousingWebApi/Controllers/AllResidentsController.cs
@@ -0,0 +1,133 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.Entity;
+using System.Data.Entity.Infrastructure;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Web.Http;
+using System.Web.Http.Description;
+using HousingWebApi;
+
+namespace HousingWebApi.Controllers
+{
+ public class AllResidentsController : ApiController
+ {
+ private DataModel db = new DataModel();
+
+ // GET: api/AllResidents
+ public IQueryable<AllResident> GetAllResidents()
+ {
+ return db.AllResidents;
+ }
+
+ // GET: api/AllResidents/5
+ [ResponseType(typeof(AllResident))]
+ public IHttpActionResult GetAllResident(string id)
+ {
+ AllResident allResident = db.AllResidents.Find(id);
+ if (allResident == null)
+ {
+ return NotFound();
+ }
+
+ return Ok(allResident);
+ }
+
+ // PUT: api/AllResidents/5
+ [ResponseType(typeof(void))]
+ public IHttpActionResult PutAllResident(string id, AllResident allResident)
+ {
+ if (!ModelState.IsValid)
+ {
+ return BadRequest(ModelState);
+ }
+
+ if (id != allResident.FirstName)
+ {
+ return BadRequest();
+ }
+
+ db.Entry(allResident).State = EntityState.Modified;
+
+ try
+ {
+ db.SaveChanges();
+ }
+ catch (DbUpdateConcurrencyException)
+ {
+ if (!AllResidentExists(id))
+ {
+ return NotFound();
+ }
+ else
+ {
+ throw;
+ }
+ }
+
+ return StatusCode(HttpStatusCode.NoContent);
+ }
+
+ // POST: api/AllResidents
+ [ResponseType(typeof(AllResident))]
+ public IHttpActionResult PostAllResident(AllResident allResident)
+ {
+ if (!ModelState.IsValid)
+ {
+ return BadRequest(ModelState);
+ }
+
+ db.AllResidents.Add(allResident);
+
+ try
+ {
+ db.SaveChanges();
+ }
+ catch (DbUpdateException)
+ {
+ if (AllResidentExists(allResident.FirstName))
+ {
+ return Conflict();
+ }
+ else
+ {
+ throw;
+ }
+ }
+
+ return CreatedAtRoute("DefaultApi", new { id = allResident.FirstName }, allResident);
+ }
+
+ // DELETE: api/AllResidents/5
+ [ResponseType(typeof(AllResident))]
+ public IHttpActionResult DeleteAllResident(string id)
+ {
+ AllResident allResident = db.AllResidents.Find(id);
+ if (allResident == null)
+ {
+ return NotFound();
+ }
+
+ db.AllResidents.Remove(allResident);
+ db.SaveChanges();
+
+ return Ok(allResident);
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ db.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ private bool AllResidentExists(string id)
+ {
+ return db.AllResidents.Count(e => e.FirstName == id) > 0;
+ }
+ }
+} \ No newline at end of file
diff --git a/ApartmentManager/HousingWebApi/Controllers/ApartmentChangesController.cs b/ApartmentManager/HousingWebApi/Controllers/ApartmentChangesController.cs
new file mode 100644
index 0000000..f96385a
--- /dev/null
+++ b/ApartmentManager/HousingWebApi/Controllers/ApartmentChangesController.cs
@@ -0,0 +1,133 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.Entity;
+using System.Data.Entity.Infrastructure;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Web.Http;
+using System.Web.Http.Description;
+using HousingWebApi;
+
+namespace HousingWebApi.Controllers
+{
+ public class ApartmentChangesController : ApiController
+ {
+ private DataModel db = new DataModel();
+
+ // GET: api/ApartmentChanges
+ public IQueryable<ApartmentChange> GetApartmentChanges()
+ {
+ return db.ApartmentChanges;
+ }
+
+ // GET: api/ApartmentChanges/5
+ [ResponseType(typeof(ApartmentChange))]
+ public IHttpActionResult GetApartmentChange(int id)
+ {
+ ApartmentChange apartmentChange = db.ApartmentChanges.Find(id);
+ if (apartmentChange == null)
+ {
+ return NotFound();
+ }
+
+ return Ok(apartmentChange);
+ }
+
+ // PUT: api/ApartmentChanges/5
+ [ResponseType(typeof(void))]
+ public IHttpActionResult PutApartmentChange(int id, ApartmentChange apartmentChange)
+ {
+ if (!ModelState.IsValid)
+ {
+ return BadRequest(ModelState);
+ }
+
+ if (id != apartmentChange.ChangeId)
+ {
+ return BadRequest();
+ }
+
+ db.Entry(apartmentChange).State = EntityState.Modified;
+
+ try
+ {
+ db.SaveChanges();
+ }
+ catch (DbUpdateConcurrencyException)
+ {
+ if (!ApartmentChangeExists(id))
+ {
+ return NotFound();
+ }
+ else
+ {
+ throw;
+ }
+ }
+
+ return StatusCode(HttpStatusCode.NoContent);
+ }
+
+ // POST: api/ApartmentChanges
+ [ResponseType(typeof(ApartmentChange))]
+ public IHttpActionResult PostApartmentChange(ApartmentChange apartmentChange)
+ {
+ if (!ModelState.IsValid)
+ {
+ return BadRequest(ModelState);
+ }
+
+ db.ApartmentChanges.Add(apartmentChange);
+
+ try
+ {
+ db.SaveChanges();
+ }
+ catch (DbUpdateException)
+ {
+ if (ApartmentChangeExists(apartmentChange.ChangeId))
+ {
+ return Conflict();
+ }
+ else
+ {
+ throw;
+ }
+ }
+
+ return CreatedAtRoute("DefaultApi", new { id = apartmentChange.ChangeId }, apartmentChange);
+ }
+
+ // DELETE: api/ApartmentChanges/5
+ [ResponseType(typeof(ApartmentChange))]
+ public IHttpActionResult DeleteApartmentChange(int id)
+ {
+ ApartmentChange apartmentChange = db.ApartmentChanges.Find(id);
+ if (apartmentChange == null)
+ {
+ return NotFound();
+ }
+
+ db.ApartmentChanges.Remove(apartmentChange);
+ db.SaveChanges();
+
+ return Ok(apartmentChange);
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ db.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ private bool ApartmentChangeExists(int id)
+ {
+ return db.ApartmentChanges.Count(e => e.ChangeId == id) > 0;
+ }
+ }
+} \ No newline at end of file
diff --git a/ApartmentManager/HousingWebApi/Controllers/ApartmentResidentsController.cs b/ApartmentManager/HousingWebApi/Controllers/ApartmentResidentsController.cs
new file mode 100644
index 0000000..a754255
--- /dev/null
+++ b/ApartmentManager/HousingWebApi/Controllers/ApartmentResidentsController.cs
@@ -0,0 +1,133 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.Entity;
+using System.Data.Entity.Infrastructure;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Web.Http;
+using System.Web.Http.Description;
+using HousingWebApi;
+
+namespace HousingWebApi.Controllers
+{
+ public class ApartmentResidentsController : ApiController
+ {
+ private DataModel db = new DataModel();
+
+ // GET: api/ApartmentResidents
+ public IQueryable<ApartmentResident> GetApartmentResidents()
+ {
+ return db.ApartmentResidents;
+ }
+
+ // GET: api/ApartmentResidents/5
+ [ResponseType(typeof(ApartmentResident))]
+ public IHttpActionResult GetApartmentResident(int id)
+ {
+ ApartmentResident apartmentResident = db.ApartmentResidents.Find(id);
+ if (apartmentResident == null)
+ {
+ return NotFound();
+ }
+
+ return Ok(apartmentResident);
+ }
+
+ // PUT: api/ApartmentResidents/5
+ [ResponseType(typeof(void))]
+ public IHttpActionResult PutApartmentResident(int id, ApartmentResident apartmentResident)
+ {
+ if (!ModelState.IsValid)
+ {
+ return BadRequest(ModelState);
+ }
+
+ if (id != apartmentResident.ApartmentNumber)
+ {
+ return BadRequest();
+ }
+
+ db.Entry(apartmentResident).State = EntityState.Modified;
+
+ try
+ {
+ db.SaveChanges();
+ }
+ catch (DbUpdateConcurrencyException)
+ {
+ if (!ApartmentResidentExists(id))
+ {
+ return NotFound();
+ }
+ else
+ {
+ throw;
+ }
+ }
+
+ return StatusCode(HttpStatusCode.NoContent);
+ }
+
+ // POST: api/ApartmentResidents
+ [ResponseType(typeof(ApartmentResident))]
+ public IHttpActionResult PostApartmentResident(ApartmentResident apartmentResident)
+ {
+ if (!ModelState.IsValid)
+ {
+ return BadRequest(ModelState);
+ }
+
+ db.ApartmentResidents.Add(apartmentResident);
+
+ try
+ {
+ db.SaveChanges();
+ }
+ catch (DbUpdateException)
+ {
+ if (ApartmentResidentExists(apartmentResident.ApartmentNumber))
+ {
+ return Conflict();
+ }
+ else
+ {
+ throw;
+ }
+ }
+
+ return CreatedAtRoute("DefaultApi", new { id = apartmentResident.ApartmentNumber }, apartmentResident);
+ }
+
+ // DELETE: api/ApartmentResidents/5
+ [ResponseType(typeof(ApartmentResident))]
+ public IHttpActionResult DeleteApartmentResident(int id)
+ {
+ ApartmentResident apartmentResident = db.ApartmentResidents.Find(id);
+ if (apartmentResident == null)
+ {
+ return NotFound();
+ }
+
+ db.ApartmentResidents.Remove(apartmentResident);
+ db.SaveChanges();
+
+ return Ok(apartmentResident);
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ db.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ private bool ApartmentResidentExists(int id)
+ {
+ return db.ApartmentResidents.Count(e => e.ApartmentNumber == id) > 0;
+ }
+ }
+} \ No newline at end of file
diff --git a/ApartmentManager/HousingWebApi/Controllers/ApartmentsController.cs b/ApartmentManager/HousingWebApi/Controllers/ApartmentsController.cs
index a3de905..90af553 100644
--- a/ApartmentManager/HousingWebApi/Controllers/ApartmentsController.cs
+++ b/ApartmentManager/HousingWebApi/Controllers/ApartmentsController.cs
@@ -44,7 +44,7 @@ namespace HousingWebApi.Controllers
return BadRequest(ModelState);
}
- if (id != apartment.ApartmentNumber)
+ if (id != apartment.ApartmentId)
{
return BadRequest();
}
@@ -87,7 +87,7 @@ namespace HousingWebApi.Controllers
}
catch (DbUpdateException)
{
- if (ApartmentExists(apartment.ApartmentNumber))
+ if (ApartmentExists(apartment.ApartmentId))
{
return Conflict();
}
@@ -97,7 +97,7 @@ namespace HousingWebApi.Controllers
}
}
- return CreatedAtRoute("DefaultApi", new { id = apartment.ApartmentNumber }, apartment);
+ return CreatedAtRoute("DefaultApi", new { id = apartment.ApartmentId }, apartment);
}
// DELETE: api/Apartments/5
@@ -127,7 +127,7 @@ namespace HousingWebApi.Controllers
private bool ApartmentExists(int id)
{
- return db.Apartments.Count(e => e.ApartmentNumber == id) > 0;
+ return db.Apartments.Count(e => e.ApartmentId == id) > 0;
}
}
} \ No newline at end of file
diff --git a/ApartmentManager/HousingWebApi/Controllers/ChangeCommentsController.cs b/ApartmentManager/HousingWebApi/Controllers/ChangeCommentsController.cs
new file mode 100644
index 0000000..bebff8e
--- /dev/null
+++ b/ApartmentManager/HousingWebApi/Controllers/ChangeCommentsController.cs
@@ -0,0 +1,133 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.Entity;
+using System.Data.Entity.Infrastructure;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Web.Http;
+using System.Web.Http.Description;
+using HousingWebApi;
+
+namespace HousingWebApi.Controllers
+{
+ public class ChangeCommentsController : ApiController
+ {
+ private DataModel db = new DataModel();
+
+ // GET: api/ChangeComments
+ public IQueryable<ChangeComment> GetChangeComments()
+ {
+ return db.ChangeComments;
+ }
+
+ // GET: api/ChangeComments/5
+ [ResponseType(typeof(ChangeComment))]
+ public IHttpActionResult GetChangeComment(int id)
+ {
+ ChangeComment changeComment = db.ChangeComments.Find(id);
+ if (changeComment == null)
+ {
+ return NotFound();
+ }
+
+ return Ok(changeComment);
+ }
+
+ // PUT: api/ChangeComments/5
+ [ResponseType(typeof(void))]
+ public IHttpActionResult PutChangeComment(int id, ChangeComment changeComment)
+ {
+ if (!ModelState.IsValid)
+ {
+ return BadRequest(ModelState);
+ }
+
+ if (id != changeComment.CommentId)
+ {
+ return BadRequest();
+ }
+
+ db.Entry(changeComment).State = EntityState.Modified;
+
+ try
+ {
+ db.SaveChanges();
+ }
+ catch (DbUpdateConcurrencyException)
+ {
+ if (!ChangeCommentExists(id))
+ {
+ return NotFound();
+ }
+ else
+ {
+ throw;
+ }
+ }
+
+ return StatusCode(HttpStatusCode.NoContent);
+ }
+
+ // POST: api/ChangeComments
+ [ResponseType(typeof(ChangeComment))]
+ public IHttpActionResult PostChangeComment(ChangeComment changeComment)
+ {
+ if (!ModelState.IsValid)
+ {
+ return BadRequest(ModelState);
+ }
+
+ db.ChangeComments.Add(changeComment);
+
+ try
+ {
+ db.SaveChanges();
+ }
+ catch (DbUpdateException)
+ {
+ if (ChangeCommentExists(changeComment.CommentId))
+ {
+ return Conflict();
+ }
+ else
+ {
+ throw;
+ }
+ }
+
+ return CreatedAtRoute("DefaultApi", new { id = changeComment.CommentId }, changeComment);
+ }
+
+ // DELETE: api/ChangeComments/5
+ [ResponseType(typeof(ChangeComment))]
+ public IHttpActionResult DeleteChangeComment(int id)
+ {
+ ChangeComment changeComment = db.ChangeComments.Find(id);
+ if (changeComment == null)
+ {
+ return NotFound();
+ }
+
+ db.ChangeComments.Remove(changeComment);
+ db.SaveChanges();
+
+ return Ok(changeComment);
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ db.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ private bool ChangeCommentExists(int id)
+ {
+ return db.ChangeComments.Count(e => e.CommentId == id) > 0;
+ }
+ }
+} \ No newline at end of file
diff --git a/ApartmentManager/HousingWebApi/Controllers/ChangeDocumentsController.cs b/ApartmentManager/HousingWebApi/Controllers/ChangeDocumentsController.cs
new file mode 100644
index 0000000..406ab33
--- /dev/null
+++ b/ApartmentManager/HousingWebApi/Controllers/ChangeDocumentsController.cs
@@ -0,0 +1,133 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.Entity;
+using System.Data.Entity.Infrastructure;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Web.Http;
+using System.Web.Http.Description;
+using HousingWebApi;
+
+namespace HousingWebApi.Controllers
+{
+ public class ChangeDocumentsController : ApiController
+ {
+ private DataModel db = new DataModel();
+
+ // GET: api/ChangeDocuments
+ public IQueryable<ChangeDocument> GetChangeDocuments()
+ {
+ return db.ChangeDocuments;
+ }
+
+ // GET: api/ChangeDocuments/5
+ [ResponseType(typeof(ChangeDocument))]
+ public IHttpActionResult GetChangeDocument(int id)
+ {
+ ChangeDocument changeDocument = db.ChangeDocuments.Find(id);
+ if (changeDocument == null)
+ {
+ return NotFound();
+ }
+
+ return Ok(changeDocument);
+ }
+
+ // PUT: api/ChangeDocuments/5
+ [ResponseType(typeof(void))]
+ public IHttpActionResult PutChangeDocument(int id, ChangeDocument changeDocument)
+ {
+ if (!ModelState.IsValid)
+ {
+ return BadRequest(ModelState);
+ }
+
+ if (id != changeDocument.DocumentId)
+ {
+ return BadRequest();
+ }
+
+ db.Entry(changeDocument).State = EntityState.Modified;
+
+ try
+ {
+ db.SaveChanges();
+ }
+ catch (DbUpdateConcurrencyException)
+ {
+ if (!ChangeDocumentExists(id))
+ {
+ return NotFound();
+ }
+ else
+ {
+ throw;
+ }
+ }
+
+ return StatusCode(HttpStatusCode.NoContent);
+ }
+
+ // POST: api/ChangeDocuments
+ [ResponseType(typeof(ChangeDocument))]
+ public IHttpActionResult PostChangeDocument(ChangeDocument changeDocument)
+ {
+ if (!ModelState.IsValid)
+ {
+ return BadRequest(ModelState);
+ }
+
+ db.ChangeDocuments.Add(changeDocument);
+
+ try
+ {
+ db.SaveChanges();
+ }
+ catch (DbUpdateException)
+ {
+ if (ChangeDocumentExists(changeDocument.DocumentId))
+ {
+ return Conflict();
+ }
+ else
+ {
+ throw;
+ }
+ }
+
+ return CreatedAtRoute("DefaultApi", new { id = changeDocument.DocumentId }, changeDocument);
+ }
+
+ // DELETE: api/ChangeDocuments/5
+ [ResponseType(typeof(ChangeDocument))]
+ public IHttpActionResult DeleteChangeDocument(int id)
+ {
+ ChangeDocument changeDocument = db.ChangeDocuments.Find(id);
+ if (changeDocument == null)
+ {
+ return NotFound();
+ }
+
+ db.ChangeDocuments.Remove(changeDocument);
+ db.SaveChanges();
+
+ return Ok(changeDocument);
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ db.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ private bool ChangeDocumentExists(int id)
+ {
+ return db.ChangeDocuments.Count(e => e.DocumentId == id) > 0;
+ }
+ }
+} \ No newline at end of file
diff --git a/ApartmentManager/HousingWebApi/Controllers/PastContractOwnersController.cs b/ApartmentManager/HousingWebApi/Controllers/DefectCommentsController.cs
index d1f3e00..ae5222d 100644
--- a/ApartmentManager/HousingWebApi/Controllers/PastContractOwnersController.cs
+++ b/ApartmentManager/HousingWebApi/Controllers/DefectCommentsController.cs
@@ -12,44 +12,44 @@ using HousingWebApi;
namespace HousingWebApi.Controllers
{
- public class PastContractOwnersController : ApiController
+ public class DefectCommentsController : ApiController
{
private DataModel db = new DataModel();
- // GET: api/PastContractOwners
- public IQueryable<PastContractOwner> GetPastContractOwners()
+ // GET: api/DefectComments
+ public IQueryable<DefectComment> GetDefectComments()
{
- return db.PastContractOwners;
+ return db.DefectComments;
}
- // GET: api/PastContractOwners/5
- [ResponseType(typeof(PastContractOwner))]
- public IHttpActionResult GetPastContractOwner(int id)
+ // GET: api/DefectComments/5
+ [ResponseType(typeof(DefectComment))]
+ public IHttpActionResult GetDefectComment(int id)
{
- PastContractOwner pastContractOwner = db.PastContractOwners.Find(id);
- if (pastContractOwner == null)
+ DefectComment defectComment = db.DefectComments.Find(id);
+ if (defectComment == null)
{
return NotFound();
}
- return Ok(pastContractOwner);
+ return Ok(defectComment);
}
- // PUT: api/PastContractOwners/5
+ // PUT: api/DefectComments/5
[ResponseType(typeof(void))]
- public IHttpActionResult PutPastContractOwner(int id, PastContractOwner pastContractOwner)
+ public IHttpActionResult PutDefectComment(int id, DefectComment defectComment)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
- if (id != pastContractOwner.Id)
+ if (id != defectComment.PictureId)
{
return BadRequest();
}
- db.Entry(pastContractOwner).State = EntityState.Modified;
+ db.Entry(defectComment).State = EntityState.Modified;
try
{
@@ -57,7 +57,7 @@ namespace HousingWebApi.Controllers
}
catch (DbUpdateConcurrencyException)
{
- if (!PastContractOwnerExists(id))
+ if (!DefectCommentExists(id))
{
return NotFound();
}
@@ -70,16 +70,16 @@ namespace HousingWebApi.Controllers
return StatusCode(HttpStatusCode.NoContent);
}
- // POST: api/PastContractOwners
- [ResponseType(typeof(PastContractOwner))]
- public IHttpActionResult PostPastContractOwner(PastContractOwner pastContractOwner)
+ // POST: api/DefectComments
+ [ResponseType(typeof(DefectComment))]
+ public IHttpActionResult PostDefectComment(DefectComment defectComment)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
- db.PastContractOwners.Add(pastContractOwner);
+ db.DefectComments.Add(defectComment);
try
{
@@ -87,7 +87,7 @@ namespace HousingWebApi.Controllers
}
catch (DbUpdateException)
{
- if (PastContractOwnerExists(pastContractOwner.Id))
+ if (DefectCommentExists(defectComment.PictureId))
{
return Conflict();
}
@@ -97,23 +97,23 @@ namespace HousingWebApi.Controllers
}
}
- return CreatedAtRoute("DefaultApi", new { id = pastContractOwner.Id }, pastContractOwner);
+ return CreatedAtRoute("DefaultApi", new { id = defectComment.PictureId }, defectComment);
}
- // DELETE: api/PastContractOwners/5
- [ResponseType(typeof(PastContractOwner))]
- public IHttpActionResult DeletePastContractOwner(int id)
+ // DELETE: api/DefectComments/5
+ [ResponseType(typeof(DefectComment))]
+ public IHttpActionResult DeleteDefectComment(int id)
{
- PastContractOwner pastContractOwner = db.PastContractOwners.Find(id);
- if (pastContractOwner == null)
+ DefectComment defectComment = db.DefectComments.Find(id);
+ if (defectComment == null)
{
return NotFound();
}
- db.PastContractOwners.Remove(pastContractOwner);
+ db.DefectComments.Remove(defectComment);
db.SaveChanges();
- return Ok(pastContractOwner);
+ return Ok(defectComment);
}
protected override void Dispose(bool disposing)
@@ -125,9 +125,9 @@ namespace HousingWebApi.Controllers
base.Dispose(disposing);
}
- private bool PastContractOwnerExists(int id)
+ private bool DefectCommentExists(int id)
{
- return db.PastContractOwners.Count(e => e.Id == id) > 0;
+ return db.DefectComments.Count(e => e.PictureId == id) > 0;
}
}
} \ No newline at end of file
diff --git a/ApartmentManager/HousingWebApi/Controllers/DefectPicturesController.cs b/ApartmentManager/HousingWebApi/Controllers/DefectPicturesController.cs
new file mode 100644
index 0000000..288a660
--- /dev/null
+++ b/ApartmentManager/HousingWebApi/Controllers/DefectPicturesController.cs
@@ -0,0 +1,133 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.Entity;
+using System.Data.Entity.Infrastructure;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Web.Http;
+using System.Web.Http.Description;
+using HousingWebApi;
+
+namespace HousingWebApi.Controllers
+{
+ public class DefectPicturesController : ApiController
+ {
+ private DataModel db = new DataModel();
+
+ // GET: api/DefectPictures
+ public IQueryable<DefectPicture> GetDefectPictures()
+ {
+ return db.DefectPictures;
+ }
+
+ // GET: api/DefectPictures/5
+ [ResponseType(typeof(DefectPicture))]
+ public IHttpActionResult GetDefectPicture(int id)
+ {
+ DefectPicture defectPicture = db.DefectPictures.Find(id);
+ if (defectPicture == null)
+ {
+ return NotFound();
+ }
+
+ return Ok(defectPicture);
+ }
+
+ // PUT: api/DefectPictures/5
+ [ResponseType(typeof(void))]
+ public IHttpActionResult PutDefectPicture(int id, DefectPicture defectPicture)
+ {
+ if (!ModelState.IsValid)
+ {
+ return BadRequest(ModelState);
+ }
+
+ if (id != defectPicture.PictureId)
+ {
+ return BadRequest();
+ }
+
+ db.Entry(defectPicture).State = EntityState.Modified;
+
+ try
+ {
+ db.SaveChanges();
+ }
+ catch (DbUpdateConcurrencyException)
+ {
+ if (!DefectPictureExists(id))
+ {
+ return NotFound();
+ }
+ else
+ {
+ throw;
+ }
+ }
+
+ return StatusCode(HttpStatusCode.NoContent);
+ }
+
+ // POST: api/DefectPictures
+ [ResponseType(typeof(DefectPicture))]
+ public IHttpActionResult PostDefectPicture(DefectPicture defectPicture)
+ {
+ if (!ModelState.IsValid)
+ {
+ return BadRequest(ModelState);
+ }
+
+ db.DefectPictures.Add(defectPicture);
+
+ try
+ {
+ db.SaveChanges();
+ }
+ catch (DbUpdateException)
+ {
+ if (DefectPictureExists(defectPicture.PictureId))
+ {
+ return Conflict();
+ }
+ else
+ {
+ throw;
+ }
+ }
+
+ return CreatedAtRoute("DefaultApi", new { id = defectPicture.PictureId }, defectPicture);
+ }
+
+ // DELETE: api/DefectPictures/5
+ [ResponseType(typeof(DefectPicture))]
+ public IHttpActionResult DeleteDefectPicture(int id)
+ {
+ DefectPicture defectPicture = db.DefectPictures.Find(id);
+ if (defectPicture == null)
+ {
+ return NotFound();
+ }
+
+ db.DefectPictures.Remove(defectPicture);
+ db.SaveChanges();
+
+ return Ok(defectPicture);
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ db.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ private bool DefectPictureExists(int id)
+ {
+ return db.DefectPictures.Count(e => e.PictureId == id) > 0;
+ }
+ }
+} \ No newline at end of file
diff --git a/ApartmentManager/HousingWebApi/Controllers/DefectsController.cs b/ApartmentManager/HousingWebApi/Controllers/DefectsController.cs
index aa6f519..c5f2909 100644
--- a/ApartmentManager/HousingWebApi/Controllers/DefectsController.cs
+++ b/ApartmentManager/HousingWebApi/Controllers/DefectsController.cs
@@ -44,7 +44,7 @@ namespace HousingWebApi.Controllers
return BadRequest(ModelState);
}
- if (id != defect.DefectNumber)
+ if (id != defect.DefectId)
{
return BadRequest();
}
@@ -87,7 +87,7 @@ namespace HousingWebApi.Controllers
}
catch (DbUpdateException)
{
- if (DefectExists(defect.DefectNumber))
+ if (DefectExists(defect.DefectId))
{
return Conflict();
}
@@ -97,7 +97,7 @@ namespace HousingWebApi.Controllers
}
}
- return CreatedAtRoute("DefaultApi", new { id = defect.DefectNumber }, defect);
+ return CreatedAtRoute("DefaultApi", new { id = defect.DefectId }, defect);
}
// DELETE: api/Defects/5
@@ -127,7 +127,7 @@ namespace HousingWebApi.Controllers
private bool DefectExists(int id)
{
- return db.Defects.Count(e => e.DefectNumber == id) > 0;
+ return db.Defects.Count(e => e.DefectId == id) > 0;
}
}
} \ No newline at end of file
diff --git a/ApartmentManager/HousingWebApi/Controllers/PastUsersController.cs b/ApartmentManager/HousingWebApi/Controllers/PastUsersController.cs
new file mode 100644
index 0000000..7c2cf0e
--- /dev/null
+++ b/ApartmentManager/HousingWebApi/Controllers/PastUsersController.cs
@@ -0,0 +1,133 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.Entity;
+using System.Data.Entity.Infrastructure;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Web.Http;
+using System.Web.Http.Description;
+using HousingWebApi;
+
+namespace HousingWebApi.Controllers
+{
+ public class PastUsersController : ApiController
+ {
+ private DataModel db = new DataModel();
+
+ // GET: api/PastUsers
+ public IQueryable<PastUser> GetPastUsers()
+ {
+ return db.PastUsers;
+ }
+
+ // GET: api/PastUsers/5
+ [ResponseType(typeof(PastUser))]
+ public IHttpActionResult GetPastUser(string id)
+ {
+ PastUser pastUser = db.PastUsers.Find(id);
+ if (pastUser == null)
+ {
+ return NotFound();
+ }
+
+ return Ok(pastUser);
+ }
+
+ // PUT: api/PastUsers/5
+ [ResponseType(typeof(void))]
+ public IHttpActionResult PutPastUser(string id, PastUser pastUser)
+ {
+ if (!ModelState.IsValid)
+ {
+ return BadRequest(ModelState);
+ }
+
+ if (id != pastUser.Username)
+ {
+ return BadRequest();
+ }
+
+ db.Entry(pastUser).State = EntityState.Modified;
+
+ try
+ {
+ db.SaveChanges();
+ }
+ catch (DbUpdateConcurrencyException)
+ {
+ if (!PastUserExists(id))
+ {
+ return NotFound();
+ }
+ else
+ {
+ throw;
+ }
+ }
+
+ return StatusCode(HttpStatusCode.NoContent);
+ }
+
+ // POST: api/PastUsers
+ [ResponseType(typeof(PastUser))]
+ public IHttpActionResult PostPastUser(PastUser pastUser)
+ {
+ if (!ModelState.IsValid)
+ {
+ return BadRequest(ModelState);
+ }
+
+ db.PastUsers.Add(pastUser);
+
+ try
+ {
+ db.SaveChanges();
+ }
+ catch (DbUpdateException)
+ {
+ if (PastUserExists(pastUser.Username))
+ {
+ return Conflict();
+ }
+ else
+ {
+ throw;
+ }
+ }
+
+ return CreatedAtRoute("DefaultApi", new { id = pastUser.Username }, pastUser);
+ }
+
+ // DELETE: api/PastUsers/5
+ [ResponseType(typeof(PastUser))]
+ public IHttpActionResult DeletePastUser(string id)
+ {
+ PastUser pastUser = db.PastUsers.Find(id);
+ if (pastUser == null)
+ {
+ return NotFound();
+ }
+
+ db.PastUsers.Remove(pastUser);
+ db.SaveChanges();
+
+ return Ok(pastUser);
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ db.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ private bool PastUserExists(string id)
+ {
+ return db.PastUsers.Count(e => e.Username == id) > 0;
+ }
+ }
+} \ No newline at end of file
diff --git a/ApartmentManager/HousingWebApi/Controllers/ResidentsController.cs b/ApartmentManager/HousingWebApi/Controllers/ResidentsController.cs
index 9cd3932..ebb0188 100644
--- a/ApartmentManager/HousingWebApi/Controllers/ResidentsController.cs
+++ b/ApartmentManager/HousingWebApi/Controllers/ResidentsController.cs
@@ -22,7 +22,7 @@ namespace HousingWebApi.Controllers
return db.Residents;
}
- // GET: api/Users/5
+ // GET: api/Residents/5
[ResponseType(typeof(Resident))]
public IHttpActionResult GetResident(int id)
{
@@ -34,27 +34,6 @@ namespace HousingWebApi.Controllers
return Ok(resident);
}
- //GET: api/Residents/1
-
- [Route("api/ApartmentResidents/{id}")]
- [ResponseType(typeof(ResidentList))]
- public IQueryable<ResidentList> GetResidents(int id)
- {
- var roomlist = from resident in db.Residents
- where (resident.ApartmentNr == id)
- select new ResidentList
- {
- ResidentNr = resident.ResidentNr,
- ApartmentNr = resident.ApartmentNr,
- FirstName = resident.FirstName,
- LastName = resident.LastName,
- BirthDate = resident.BirthDate,
- Phone = resident.Phone,
- Email = resident.Email,
- Picture = resident.Picture
- };
- return roomlist;
- }
// PUT: api/Residents/5
[ResponseType(typeof(void))]
@@ -65,7 +44,7 @@ namespace HousingWebApi.Controllers
return BadRequest(ModelState);
}
- if (id != resident.ResidentNr)
+ if (id != resident.ResidentId)
{
return BadRequest();
}
@@ -108,7 +87,7 @@ namespace HousingWebApi.Controllers
}
catch (DbUpdateException)
{
- if (ResidentExists(resident.ResidentNr))
+ if (ResidentExists(resident.ResidentId))
{
return Conflict();
}
@@ -118,7 +97,7 @@ namespace HousingWebApi.Controllers
}
}
- return CreatedAtRoute("DefaultApi", new { id = resident.ResidentNr }, resident);
+ return CreatedAtRoute("DefaultApi", new { id = resident.ResidentId }, resident);
}
// DELETE: api/Residents/5
@@ -148,7 +127,7 @@ namespace HousingWebApi.Controllers
private bool ResidentExists(int id)
{
- return db.Residents.Count(e => e.ResidentNr == id) > 0;
+ return db.Residents.Count(e => e.ResidentId == id) > 0;
}
}
} \ No newline at end of file
diff --git a/ApartmentManager/HousingWebApi/Controllers/UsersController.cs b/ApartmentManager/HousingWebApi/Controllers/UsersController.cs
index a8c03af..4db8e9d 100644
--- a/ApartmentManager/HousingWebApi/Controllers/UsersController.cs
+++ b/ApartmentManager/HousingWebApi/Controllers/UsersController.cs
@@ -1,9 +1,14 @@
-using System.Data.Entity;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Linq;
using System.Net;
+using System.Net.Http;
using System.Web.Http;
using System.Web.Http.Description;
+using HousingWebApi;
namespace HousingWebApi.Controllers
{
@@ -17,23 +22,9 @@ namespace HousingWebApi.Controllers
return db.Users;
}
- // GET: api/Users/by-username/username
- [ResponseType(typeof(User))]
- [Route("api/Users/by-username/{username}")]
- public IHttpActionResult GetUserByUsername(string username)
- {
- User user = db.Users.SingleOrDefault(u => u.Username == username);
- if (user == null)
- {
- return NotFound();
- }
-
- return Ok(user);
- }
-
// GET: api/Users/5
[ResponseType(typeof(User))]
- public IHttpActionResult GetUser(int id)
+ public IHttpActionResult GetUser(string id)
{
User user = db.Users.Find(id);
if (user == null)
@@ -46,14 +37,14 @@ namespace HousingWebApi.Controllers
// PUT: api/Users/5
[ResponseType(typeof(void))]
- public IHttpActionResult PutUser(int id, User user)
+ public IHttpActionResult PutUser(string id, User user)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
- if (id != user.ApartmentNr)
+ if (id != user.Username)
{
return BadRequest();
}
@@ -96,7 +87,7 @@ namespace HousingWebApi.Controllers
}
catch (DbUpdateException)
{
- if (UserExists(user.ApartmentNr))
+ if (UserExists(user.Username))
{
return Conflict();
}
@@ -106,12 +97,12 @@ namespace HousingWebApi.Controllers
}
}
- return CreatedAtRoute("DefaultApi", new { id = user.ApartmentNr }, user);
+ return CreatedAtRoute("DefaultApi", new { id = user.Username }, user);
}
// DELETE: api/Users/5
[ResponseType(typeof(User))]
- public IHttpActionResult DeleteUser(int id)
+ public IHttpActionResult DeleteUser(string id)
{
User user = db.Users.Find(id);
if (user == null)
@@ -134,9 +125,9 @@ namespace HousingWebApi.Controllers
base.Dispose(disposing);
}
- private bool UserExists(int id)
+ private bool UserExists(string id)
{
- return db.Users.Count(e => e.ApartmentNr == id) > 0;
+ return db.Users.Count(e => e.Username == id) > 0;
}
}
} \ No newline at end of file
diff --git a/ApartmentManager/HousingWebApi/DataModel.cs b/ApartmentManager/HousingWebApi/DataModel.cs
index fa16d44..0b953a6 100644
--- a/ApartmentManager/HousingWebApi/DataModel.cs
+++ b/ApartmentManager/HousingWebApi/DataModel.cs
@@ -14,62 +14,77 @@ namespace HousingWebApi
}
public virtual DbSet<Apartment> Apartments { get; set; }
+ public virtual DbSet<ApartmentChange> ApartmentChanges { get; set; }
+ public virtual DbSet<ChangeComment> ChangeComments { get; set; }
+ public virtual DbSet<ChangeDocument> ChangeDocuments { get; set; }
public virtual DbSet<Defect> Defects { get; set; }
- public virtual DbSet<PastContractOwner> PastContractOwners { get; set; }
+ public virtual DbSet<DefectComment> DefectComments { get; set; }
+ public virtual DbSet<DefectPicture> DefectPictures { get; set; }
+ public virtual DbSet<PastUser> PastUsers { get; set; }
public virtual DbSet<Resident> Residents { get; set; }
public virtual DbSet<User> Users { get; set; }
public virtual DbSet<AllResident> AllResidents { get; set; }
public virtual DbSet<ApartmentResident> ApartmentResidents { get; set; }
- public virtual DbSet<database_firewall_rules> database_firewall_rules { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<Apartment>()
- .Property(e => e.Size)
- .HasPrecision(18, 0);
-
- modelBuilder.Entity<Apartment>()
- .Property(e => e.MonthlyCharge)
- .IsUnicode(false);
-
- modelBuilder.Entity<Apartment>()
.Property(e => e.Address)
.IsUnicode(false);
modelBuilder.Entity<Apartment>()
- .Property(e => e.PlanPicture)
- .IsUnicode(false);
+ .HasMany(e => e.ApartmentChanges)
+ .WithRequired(e => e.Apartment)
+ .WillCascadeOnDelete(false);
modelBuilder.Entity<Apartment>()
.HasMany(e => e.Defects)
.WithRequired(e => e.Apartment)
- .HasForeignKey(e => e.ApartmentNr)
+ .WillCascadeOnDelete(false);
+
+ modelBuilder.Entity<Apartment>()
+ .HasMany(e => e.PastUsers)
+ .WithRequired(e => e.Apartment)
.WillCascadeOnDelete(false);
modelBuilder.Entity<Apartment>()
.HasMany(e => e.Residents)
.WithRequired(e => e.Apartment)
- .HasForeignKey(e => e.ApartmentNr)
.WillCascadeOnDelete(false);
modelBuilder.Entity<Apartment>()
- .HasOptional(e => e.User)
- .WithRequired(e => e.Apartment);
+ .HasMany(e => e.Users)
+ .WithRequired(e => e.Apartment)
+ .WillCascadeOnDelete(false);
- modelBuilder.Entity<Defect>()
+ modelBuilder.Entity<ApartmentChange>()
.Property(e => e.Name)
.IsUnicode(false);
- modelBuilder.Entity<Defect>()
- .Property(e => e.Picture)
+ modelBuilder.Entity<ApartmentChange>()
+ .Property(e => e.Description)
.IsUnicode(false);
- modelBuilder.Entity<Defect>()
- .Property(e => e.Picture2)
+ modelBuilder.Entity<ApartmentChange>()
+ .Property(e => e.Status)
+ .IsUnicode(false);
+
+ modelBuilder.Entity<ApartmentChange>()
+ .HasMany(e => e.ChangeComments)
+ .WithRequired(e => e.ApartmentChange)
+ .WillCascadeOnDelete(false);
+
+ modelBuilder.Entity<ApartmentChange>()
+ .HasMany(e => e.ChangeDocuments)
+ .WithRequired(e => e.ApartmentChange)
+ .WillCascadeOnDelete(false);
+
+ modelBuilder.Entity<ChangeComment>()
+ .Property(e => e.Comment)
.IsUnicode(false);
modelBuilder.Entity<Defect>()
- .Property(e => e.Picture3)
+ .Property(e => e.Name)
.IsUnicode(false);
modelBuilder.Entity<Defect>()
@@ -77,16 +92,46 @@ namespace HousingWebApi
.IsUnicode(false);
modelBuilder.Entity<Defect>()
- .Property(e => e.Comment)
+ .Property(e => e.Status)
.IsUnicode(false);
modelBuilder.Entity<Defect>()
- .Property(e => e.Status)
+ .HasMany(e => e.DefectComments)
+ .WithRequired(e => e.Defect)
+ .WillCascadeOnDelete(false);
+
+ modelBuilder.Entity<Defect>()
+ .HasMany(e => e.DefectPictures)
+ .WithRequired(e => e.Defect)
+ .WillCascadeOnDelete(false);
+
+ modelBuilder.Entity<DefectComment>()
+ .Property(e => e.Picture)
.IsUnicode(false);
- modelBuilder.Entity<PastContractOwner>()
- .Property(e => e.ApartmentNr)
- .IsFixedLength();
+ modelBuilder.Entity<PastUser>()
+ .Property(e => e.Username)
+ .IsUnicode(false);
+
+ modelBuilder.Entity<PastUser>()
+ .Property(e => e.Password)
+ .IsUnicode(false);
+
+ modelBuilder.Entity<PastUser>()
+ .Property(e => e.FirstName)
+ .IsUnicode(false);
+
+ modelBuilder.Entity<PastUser>()
+ .Property(e => e.LastName)
+ .IsUnicode(false);
+
+ modelBuilder.Entity<PastUser>()
+ .Property(e => e.Phone)
+ .IsUnicode(false);
+
+ modelBuilder.Entity<PastUser>()
+ .Property(e => e.Email)
+ .IsUnicode(false);
modelBuilder.Entity<Resident>()
.Property(e => e.FirstName)
@@ -97,11 +142,11 @@ namespace HousingWebApi
.IsUnicode(false);
modelBuilder.Entity<Resident>()
- .Property(e => e.Email)
+ .Property(e => e.Phone)
.IsUnicode(false);
modelBuilder.Entity<Resident>()
- .Property(e => e.Picture)
+ .Property(e => e.Email)
.IsUnicode(false);
modelBuilder.Entity<User>()
@@ -113,10 +158,6 @@ namespace HousingWebApi
.IsUnicode(false);
modelBuilder.Entity<User>()
- .Property(e => e.Type)
- .IsUnicode(false);
-
- modelBuilder.Entity<User>()
.Property(e => e.FirstName)
.IsUnicode(false);
@@ -132,22 +173,6 @@ namespace HousingWebApi
.Property(e => e.Email)
.IsUnicode(false);
- modelBuilder.Entity<User>()
- .Property(e => e.SecondName)
- .IsUnicode(false);
-
- modelBuilder.Entity<User>()
- .Property(e => e.SecondLastName)
- .IsUnicode(false);
-
- modelBuilder.Entity<User>()
- .Property(e => e.SecondPhone)
- .IsUnicode(false);
-
- modelBuilder.Entity<User>()
- .Property(e => e.SecondEmail)
- .IsUnicode(false);
-
modelBuilder.Entity<AllResident>()
.Property(e => e.FirstName)
.IsUnicode(false);
@@ -163,14 +188,6 @@ namespace HousingWebApi
modelBuilder.Entity<ApartmentResident>()
.Property(e => e.Email)
.IsUnicode(false);
-
- modelBuilder.Entity<database_firewall_rules>()
- .Property(e => e.start_ip_address)
- .IsUnicode(false);
-
- modelBuilder.Entity<database_firewall_rules>()
- .Property(e => e.end_ip_address)
- .IsUnicode(false);
}
}
}
diff --git a/ApartmentManager/HousingWebApi/HousingWebApi.csproj b/ApartmentManager/HousingWebApi/HousingWebApi.csproj
new file mode 100644
index 0000000..18a8c73
--- /dev/null
+++ b/ApartmentManager/HousingWebApi/HousingWebApi.csproj
@@ -0,0 +1,330 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" />
+ <Import Project="..\packages\Microsoft.Net.Compilers.1.3.2\build\Microsoft.Net.Compilers.props" Condition="Exists('..\packages\Microsoft.Net.Compilers.1.3.2\build\Microsoft.Net.Compilers.props')" />
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>
+ </ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{D777744A-9676-4193-BD59-6F30C724C87A}</ProjectGuid>
+ <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>HousingWebApi</RootNamespace>
+ <AssemblyName>HousingWebApi</AssemblyName>
+ <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
+ <MvcBuildViews>false</MvcBuildViews>
+ <UseIISExpress>true</UseIISExpress>
+ <IISExpressSSLPort />
+ <IISExpressAnonymousAuthentication />
+ <IISExpressWindowsAuthentication />
+ <IISExpressUseClassicPipelineMode />
+ <UseGlobalApplicationHostFile />
+ <NuGetPackageImportStamp>
+ </NuGetPackageImportStamp>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+ <HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll</HintPath>
+ </Reference>
+ <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+ <HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Security" />
+ <Reference Include="System.Web.Entity" />
+ <Reference Include="System.Web.ApplicationServices" />
+ <Reference Include="System.ComponentModel.DataAnnotations" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Web" />
+ <Reference Include="System.Web.Abstractions" />
+ <Reference Include="System.Web.Routing" />
+ <Reference Include="System.Xml" />
+ <Reference Include="System.Configuration" />
+ <Reference Include="System.Runtime.Serialization" />
+ <Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <Private>True</Private>
+ <HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
+ </Reference>
+ <Reference Include="Newtonsoft.Json">
+ <HintPath>..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Net.Http">
+ </Reference>
+ <Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Net.Http.WebRequest">
+ </Reference>
+ <Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <Private>True</Private>
+ <HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Web.Http.WebHost, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <Private>True</Private>
+ <HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Web.Optimization">
+ <HintPath>..\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <Private>True</Private>
+ <HintPath>..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <Private>True</Private>
+ <HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <Private>True</Private>
+ <HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <Private>True</Private>
+ <HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
+ </Reference>
+ <Reference Include="WebGrease">
+ <Private>True</Private>
+ <HintPath>..\packages\WebGrease.1.5.2\lib\WebGrease.dll</HintPath>
+ </Reference>
+ <Reference Include="Antlr3.Runtime">
+ <Private>True</Private>
+ <HintPath>..\packages\Antlr.3.4.1.9004\lib\Antlr3.Runtime.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Reference Include="Microsoft.ApplicationInsights">
+ <HintPath>..\packages\Microsoft.ApplicationInsights.2.2.0\lib\net45\Microsoft.ApplicationInsights.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.AI.Agent.Intercept">
+ <HintPath>..\packages\Microsoft.ApplicationInsights.Agent.Intercept.2.0.6\lib\net45\Microsoft.AI.Agent.Intercept.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.AI.DependencyCollector">
+ <HintPath>..\packages\Microsoft.ApplicationInsights.DependencyCollector.2.2.0\lib\net45\Microsoft.AI.DependencyCollector.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.AI.PerfCounterCollector">
+ <HintPath>..\packages\Microsoft.ApplicationInsights.PerfCounterCollector.2.2.0\lib\net45\Microsoft.AI.PerfCounterCollector.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.AI.ServerTelemetryChannel">
+ <HintPath>..\packages\Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.2.2.0\lib\net45\Microsoft.AI.ServerTelemetryChannel.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.AI.WindowsServer">
+ <HintPath>..\packages\Microsoft.ApplicationInsights.WindowsServer.2.2.0\lib\net45\Microsoft.AI.WindowsServer.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.AI.Web">
+ <HintPath>..\packages\Microsoft.ApplicationInsights.Web.2.2.0\lib\net45\Microsoft.AI.Web.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Controllers\AllResidentsController.cs" />
+ <Compile Include="Controllers\ApartmentResidentsController.cs" />
+ <Compile Include="Models\AllResident.cs" />
+ <Compile Include="Models\Apartment.cs" />
+ <Compile Include="Models\ApartmentChange.cs" />
+ <Compile Include="Models\ApartmentResident.cs" />
+ <Compile Include="Models\ChangeComment.cs" />
+ <Compile Include="Models\ChangeDocument.cs" />
+ <Compile Include="App_Start\BundleConfig.cs" />
+ <Compile Include="App_Start\FilterConfig.cs" />
+ <Compile Include="App_Start\RouteConfig.cs" />
+ <Compile Include="App_Start\WebApiConfig.cs" />
+ <Compile Include="Areas\HelpPage\ApiDescriptionExtensions.cs" />
+ <Compile Include="Areas\HelpPage\App_Start\HelpPageConfig.cs" />
+ <Compile Include="Areas\HelpPage\Controllers\HelpController.cs" />
+ <Compile Include="Areas\HelpPage\HelpPageAreaRegistration.cs" />
+ <Compile Include="Areas\HelpPage\HelpPageConfigurationExtensions.cs" />
+ <Compile Include="Areas\HelpPage\ModelDescriptions\CollectionModelDescription.cs" />
+ <Compile Include="Areas\HelpPage\ModelDescriptions\ComplexTypeModelDescription.cs" />
+ <Compile Include="Areas\HelpPage\ModelDescriptions\DictionaryModelDescription.cs" />
+ <Compile Include="Areas\HelpPage\ModelDescriptions\EnumTypeModelDescription.cs" />
+ <Compile Include="Areas\HelpPage\ModelDescriptions\EnumValueDescription.cs" />
+ <Compile Include="Areas\HelpPage\ModelDescriptions\IModelDocumentationProvider.cs" />
+ <Compile Include="Areas\HelpPage\ModelDescriptions\KeyValuePairModelDescription.cs" />
+ <Compile Include="Areas\HelpPage\ModelDescriptions\ModelDescription.cs" />
+ <Compile Include="Areas\HelpPage\ModelDescriptions\ModelDescriptionGenerator.cs" />
+ <Compile Include="Areas\HelpPage\ModelDescriptions\ModelNameAttribute.cs" />
+ <Compile Include="Areas\HelpPage\ModelDescriptions\ModelNameHelper.cs" />
+ <Compile Include="Areas\HelpPage\ModelDescriptions\ParameterAnnotation.cs" />
+ <Compile Include="Areas\HelpPage\ModelDescriptions\ParameterDescription.cs" />
+ <Compile Include="Areas\HelpPage\ModelDescriptions\SimpleTypeModelDescription.cs" />
+ <Compile Include="Areas\HelpPage\Models\HelpPageApiModel.cs" />
+ <Compile Include="Areas\HelpPage\SampleGeneration\HelpPageSampleGenerator.cs" />
+ <Compile Include="Areas\HelpPage\SampleGeneration\HelpPageSampleKey.cs" />
+ <Compile Include="Areas\HelpPage\SampleGeneration\ImageSample.cs" />
+ <Compile Include="Areas\HelpPage\SampleGeneration\InvalidSample.cs" />
+ <Compile Include="Areas\HelpPage\SampleGeneration\ObjectGenerator.cs" />
+ <Compile Include="Areas\HelpPage\SampleGeneration\SampleDirection.cs" />
+ <Compile Include="Areas\HelpPage\SampleGeneration\TextSample.cs" />
+ <Compile Include="Areas\HelpPage\XmlDocumentationProvider.cs" />
+ <Compile Include="Controllers\ApartmentChangesController.cs" />
+ <Compile Include="Controllers\ApartmentsController.cs" />
+ <Compile Include="Controllers\ChangeCommentsController.cs" />
+ <Compile Include="Controllers\ChangeDocumentsController.cs" />
+ <Compile Include="Controllers\DefectCommentsController.cs" />
+ <Compile Include="Controllers\DefectPicturesController.cs" />
+ <Compile Include="Controllers\DefectsController.cs" />
+ <Compile Include="Controllers\HomeController.cs" />
+ <Compile Include="Controllers\PastUsersController.cs" />
+ <Compile Include="Controllers\ResidentsController.cs" />
+ <Compile Include="Controllers\UsersController.cs" />
+ <Compile Include="DataModel.cs" />
+ <Compile Include="Models\Defect.cs" />
+ <Compile Include="Models\DefectComment.cs" />
+ <Compile Include="Models\DefectPicture.cs" />
+ <Compile Include="Global.asax.cs">
+ <DependentUpon>Global.asax</DependentUpon>
+ </Compile>
+ <Compile Include="Models\PastUser.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Models\Resident.cs" />
+ <Compile Include="Models\User.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="Areas\HelpPage\HelpPage.css" />
+ <Content Include="Content\bootstrap.css" />
+ <Content Include="Content\bootstrap.min.css" />
+ <Content Include="favicon.ico" />
+ <Content Include="fonts\glyphicons-halflings-regular.svg" />
+ <Content Include="Global.asax" />
+ <Content Include="Scripts\bootstrap.js" />
+ <Content Include="Scripts\bootstrap.min.js" />
+ <Content Include="Areas\HelpPage\Views\Web.config" />
+ <Content Include="Areas\HelpPage\Views\Shared\_Layout.cshtml" />
+ <Content Include="Areas\HelpPage\Views\Help\ResourceModel.cshtml" />
+ <Content Include="Areas\HelpPage\Views\Help\Index.cshtml" />
+ <Content Include="Areas\HelpPage\Views\Help\DisplayTemplates\TextSample.cshtml" />
+ <Content Include="Areas\HelpPage\Views\Help\DisplayTemplates\SimpleTypeModelDescription.cshtml" />
+ <Content Include="Areas\HelpPage\Views\Help\DisplayTemplates\Samples.cshtml" />
+ <Content Include="Areas\HelpPage\Views\Help\DisplayTemplates\Parameters.cshtml" />
+ <Content Include="Areas\HelpPage\Views\Help\DisplayTemplates\ModelDescriptionLink.cshtml" />
+ <Content Include="Areas\HelpPage\Views\Help\DisplayTemplates\KeyValuePairModelDescription.cshtml" />
+ <Content Include="Areas\HelpPage\Views\Help\DisplayTemplates\InvalidSample.cshtml" />
+ <Content Include="Areas\HelpPage\Views\Help\DisplayTemplates\ImageSample.cshtml" />
+ <Content Include="Areas\HelpPage\Views\Help\DisplayTemplates\HelpPageApiModel.cshtml" />
+ <Content Include="Areas\HelpPage\Views\Help\DisplayTemplates\EnumTypeModelDescription.cshtml" />
+ <Content Include="Areas\HelpPage\Views\Help\DisplayTemplates\DictionaryModelDescription.cshtml" />
+ <Content Include="Areas\HelpPage\Views\Help\DisplayTemplates\ComplexTypeModelDescription.cshtml" />
+ <Content Include="Areas\HelpPage\Views\Help\DisplayTemplates\CollectionModelDescription.cshtml" />
+ <Content Include="Areas\HelpPage\Views\Help\DisplayTemplates\ApiGroup.cshtml" />
+ <Content Include="Areas\HelpPage\Views\Help\Api.cshtml" />
+ <Content Include="ApplicationInsights.config">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <None Include="Scripts\jquery-1.10.2.intellisense.js" />
+ <Content Include="Scripts\jquery-1.10.2.js" />
+ <Content Include="Scripts\jquery-1.10.2.min.js" />
+ <Content Include="Scripts\modernizr-2.6.2.js" />
+ <Content Include="Scripts\respond.js" />
+ <Content Include="Scripts\respond.min.js" />
+ <Content Include="Web.config">
+ <SubType>Designer</SubType>
+ </Content>
+ <Content Include="Web.Debug.config">
+ <DependentUpon>Web.config</DependentUpon>
+ </Content>
+ <Content Include="Web.Release.config">
+ <DependentUpon>Web.config</DependentUpon>
+ </Content>
+ <Content Include="Areas\HelpPage\Views\_ViewStart.cshtml" />
+ <Content Include="Content\Site.css" />
+ <Content Include="Views\Web.config" />
+ <Content Include="Views\_ViewStart.cshtml" />
+ <Content Include="Views\Home\Index.cshtml" />
+ <Content Include="Views\Shared\Error.cshtml" />
+ <Content Include="Views\Shared\_Layout.cshtml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Folder Include="App_Data\" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="fonts\glyphicons-halflings-regular.woff" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="fonts\glyphicons-halflings-regular.ttf" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="fonts\glyphicons-halflings-regular.eot" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="packages.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="Scripts\jquery-1.10.2.min.map" />
+ </ItemGroup>
+ <PropertyGroup>
+ <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
+ <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
+ </PropertyGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
+ <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
+ <Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
+ <AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
+ </Target>
+ <ProjectExtensions>
+ <VisualStudio>
+ <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
+ <WebProjectProperties>
+ <UseIIS>True</UseIIS>
+ <AutoAssignPort>True</AutoAssignPort>
+ <DevelopmentServerPort>58478</DevelopmentServerPort>
+ <DevelopmentServerVPath>/</DevelopmentServerVPath>
+ <IISUrl>http://localhost:60916/</IISUrl>
+ <NTLMAuthentication>False</NTLMAuthentication>
+ <UseCustomServer>False</UseCustomServer>
+ <CustomServerUrl>
+ </CustomServerUrl>
+ <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
+ </WebProjectProperties>
+ </FlavorProperties>
+ </VisualStudio>
+ </ProjectExtensions>
+ <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+ <PropertyGroup>
+ <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
+ </PropertyGroup>
+ <Error Condition="!Exists('..\packages\Microsoft.Net.Compilers.1.3.2\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Net.Compilers.1.3.2\build\Microsoft.Net.Compilers.props'))" />
+ <Error Condition="!Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />
+ </Target>
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target> -->
+</Project> \ No newline at end of file
diff --git a/ApartmentManager/HousingWebApi/Models/Apartment.cs b/ApartmentManager/HousingWebApi/Models/Apartment.cs
index 7481344..d1ac1d5 100644
--- a/ApartmentManager/HousingWebApi/Models/Apartment.cs
+++ b/ApartmentManager/HousingWebApi/Models/Apartment.cs
@@ -6,40 +6,48 @@ namespace HousingWebApi
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.Spatial;
+ [Table("Apartment")]
public partial class Apartment
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public Apartment()
{
+ ApartmentChanges = new HashSet<ApartmentChange>();
Defects = new HashSet<Defect>();
+ PastUsers = new HashSet<PastUser>();
Residents = new HashSet<Resident>();
+ Users = new HashSet<User>();
}
- [Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
- public int ApartmentNumber { get; set; }
+ public int ApartmentId { get; set; }
- public decimal Size { get; set; }
+ public double? Size { get; set; }
- public int NumberOfRooms { get; set; }
+ public int? NumberOfRooms { get; set; }
- [StringLength(10)]
- public string MonthlyCharge { get; set; }
+ public double? MonthlyCharge { get; set; }
public int? Floor { get; set; }
- [StringLength(50)]
+ [StringLength(100)]
public string Address { get; set; }
- [StringLength(200)]
- public string PlanPicture { get; set; }
+ public byte[] PlanPicture { get; set; }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+ public virtual ICollection<ApartmentChange> ApartmentChanges { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<Defect> Defects { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+ public virtual ICollection<PastUser> PastUsers { get; set; }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<Resident> Residents { get; set; }
- public virtual User User { get; set; }
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+ public virtual ICollection<User> Users { get; set; }
}
}
diff --git a/ApartmentManager/HousingWebApi/Models/ApartmentChange.cs b/ApartmentManager/HousingWebApi/Models/ApartmentChange.cs
new file mode 100644
index 0000000..e14a35e
--- /dev/null
+++ b/ApartmentManager/HousingWebApi/Models/ApartmentChange.cs
@@ -0,0 +1,44 @@
+namespace HousingWebApi
+{
+ using System;
+ using System.Collections.Generic;
+ using System.ComponentModel.DataAnnotations;
+ using System.ComponentModel.DataAnnotations.Schema;
+ using System.Data.Entity.Spatial;
+
+ [Table("ApartmentChange")]
+ public partial class ApartmentChange
+ {
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
+ public ApartmentChange()
+ {
+ ChangeComments = new HashSet<ChangeComment>();
+ ChangeDocuments = new HashSet<ChangeDocument>();
+ }
+
+ [Key]
+ [DatabaseGenerated(DatabaseGeneratedOption.None)]
+ public int ChangeId { get; set; }
+
+ public int ApartmentId { get; set; }
+
+ [StringLength(50)]
+ public string Name { get; set; }
+
+ [Column(TypeName = "date")]
+ public DateTime? UploadDate { get; set; }
+
+ public string Description { get; set; }
+
+ [StringLength(50)]
+ public string Status { get; set; }
+
+ public virtual Apartment Apartment { get; set; }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+ public virtual ICollection<ChangeComment> ChangeComments { get; set; }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+ public virtual ICollection<ChangeDocument> ChangeDocuments { get; set; }
+ }
+}
diff --git a/ApartmentManager/HousingWebAPI/Models/ApartmentResident.cs b/ApartmentManager/HousingWebApi/Models/ApartmentResident.cs
index 092c95f..092c95f 100644
--- a/ApartmentManager/HousingWebAPI/Models/ApartmentResident.cs
+++ b/ApartmentManager/HousingWebApi/Models/ApartmentResident.cs
diff --git a/ApartmentManager/HousingWebApi/Models/ChangeComment.cs b/ApartmentManager/HousingWebApi/Models/ChangeComment.cs
new file mode 100644
index 0000000..3c5d8d8
--- /dev/null
+++ b/ApartmentManager/HousingWebApi/Models/ChangeComment.cs
@@ -0,0 +1,22 @@
+namespace HousingWebApi
+{
+ using System;
+ using System.Collections.Generic;
+ using System.ComponentModel.DataAnnotations;
+ using System.ComponentModel.DataAnnotations.Schema;
+ using System.Data.Entity.Spatial;
+
+ [Table("ChangeComment")]
+ public partial class ChangeComment
+ {
+ [Key]
+ [DatabaseGenerated(DatabaseGeneratedOption.None)]
+ public int CommentId { get; set; }
+
+ public int ChangeId { get; set; }
+
+ public string Comment { get; set; }
+
+ public virtual ApartmentChange ApartmentChange { get; set; }
+ }
+}
diff --git a/ApartmentManager/HousingWebApi/Models/ChangeDocument.cs b/ApartmentManager/HousingWebApi/Models/ChangeDocument.cs
new file mode 100644
index 0000000..9e910dc
--- /dev/null
+++ b/ApartmentManager/HousingWebApi/Models/ChangeDocument.cs
@@ -0,0 +1,22 @@
+namespace HousingWebApi
+{
+ using System;
+ using System.Collections.Generic;
+ using System.ComponentModel.DataAnnotations;
+ using System.ComponentModel.DataAnnotations.Schema;
+ using System.Data.Entity.Spatial;
+
+ [Table("ChangeDocument")]
+ public partial class ChangeDocument
+ {
+ [Key]
+ [DatabaseGenerated(DatabaseGeneratedOption.None)]
+ public int DocumentId { get; set; }
+
+ public int ChangeId { get; set; }
+
+ public byte[] Document { get; set; }
+
+ public virtual ApartmentChange ApartmentChange { get; set; }
+ }
+}
diff --git a/ApartmentManager/HousingWebApi/Models/Defect.cs b/ApartmentManager/HousingWebApi/Models/Defect.cs
index b439078..5200124 100644
--- a/ApartmentManager/HousingWebApi/Models/Defect.cs
+++ b/ApartmentManager/HousingWebApi/Models/Defect.cs
@@ -6,41 +6,38 @@ namespace HousingWebApi
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.Spatial;
+ [Table("Defect")]
public partial class Defect
{
- [Key]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
+ public Defect()
+ {
+ DefectComments = new HashSet<DefectComment>();
+ DefectPictures = new HashSet<DefectPicture>();
+ }
+
[DatabaseGenerated(DatabaseGeneratedOption.None)]
- public int DefectNumber { get; set; }
+ public int DefectId { get; set; }
- public int ApartmentNr { get; set; }
+ public int ApartmentId { get; set; }
- [Required]
[StringLength(50)]
public string Name { get; set; }
[Column(TypeName = "date")]
- public DateTime DateUploaded { get; set; }
-
- [Required]
- [StringLength(200)]
- public string Picture { get; set; }
-
- [StringLength(200)]
- public string Picture2 { get; set; }
-
- [StringLength(200)]
- public string Picture3 { get; set; }
+ public DateTime? UploadDate { get; set; }
- [Column(TypeName = "text")]
- [Required]
public string Description { get; set; }
- [Column(TypeName = "text")]
- public string Comment { get; set; }
-
- [StringLength(10)]
+ [StringLength(50)]
public string Status { get; set; }
public virtual Apartment Apartment { get; set; }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+ public virtual ICollection<DefectComment> DefectComments { get; set; }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+ public virtual ICollection<DefectPicture> DefectPictures { get; set; }
}
}
diff --git a/ApartmentManager/HousingWebApi/Models/PastContractOwner.cs b/ApartmentManager/HousingWebApi/Models/DefectComment.cs
index 273952a..b05f790 100644
--- a/ApartmentManager/HousingWebApi/Models/PastContractOwner.cs
+++ b/ApartmentManager/HousingWebApi/Models/DefectComment.cs
@@ -6,12 +6,17 @@ namespace HousingWebApi
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.Spatial;
- public partial class PastContractOwner
+ [Table("DefectComment")]
+ public partial class DefectComment
{
+ [Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
- public int Id { get; set; }
+ public int PictureId { get; set; }
- [StringLength(10)]
- public string ApartmentNr { get; set; }
+ public int DefectId { get; set; }
+
+ public string Picture { get; set; }
+
+ public virtual Defect Defect { get; set; }
}
}
diff --git a/ApartmentManager/HousingWebApi/Models/DefectPicture.cs b/ApartmentManager/HousingWebApi/Models/DefectPicture.cs
new file mode 100644
index 0000000..6a83338
--- /dev/null
+++ b/ApartmentManager/HousingWebApi/Models/DefectPicture.cs
@@ -0,0 +1,22 @@
+namespace HousingWebApi
+{
+ using System;
+ using System.Collections.Generic;
+ using System.ComponentModel.DataAnnotations;
+ using System.ComponentModel.DataAnnotations.Schema;
+ using System.Data.Entity.Spatial;
+
+ [Table("DefectPicture")]
+ public partial class DefectPicture
+ {
+ [Key]
+ [DatabaseGenerated(DatabaseGeneratedOption.None)]
+ public int PictureId { get; set; }
+
+ public int DefectId { get; set; }
+
+ public byte[] Picture { get; set; }
+
+ public virtual Defect Defect { get; set; }
+ }
+}
diff --git a/ApartmentManager/HousingWebApi/Models/PastUser.cs b/ApartmentManager/HousingWebApi/Models/PastUser.cs
new file mode 100644
index 0000000..f258d34
--- /dev/null
+++ b/ApartmentManager/HousingWebApi/Models/PastUser.cs
@@ -0,0 +1,49 @@
+namespace HousingWebApi
+{
+ using System;
+ using System.Collections.Generic;
+ using System.ComponentModel.DataAnnotations;
+ using System.ComponentModel.DataAnnotations.Schema;
+ using System.Data.Entity.Spatial;
+
+ [Table("PastUser")]
+ public partial class PastUser
+ {
+ [Key]
+ [StringLength(30)]
+ public string Username { get; set; }
+
+ public int ApartmentId { get; set; }
+
+ [Required]
+ [StringLength(30)]
+ public string Password { get; set; }
+
+ public bool IsBm { get; set; }
+
+ [StringLength(30)]
+ public string FirstName { get; set; }
+
+ [StringLength(30)]
+ public string LastName { get; set; }
+
+ [Column(TypeName = "date")]
+ public DateTime? BirthDate { get; set; }
+
+ [StringLength(20)]
+ public string Phone { get; set; }
+
+ [StringLength(50)]
+ public string Email { get; set; }
+
+ public byte[] Picture { get; set; }
+
+ [Column(TypeName = "date")]
+ public DateTime? MoveInDate { get; set; }
+
+ [Column(TypeName = "date")]
+ public DateTime? MoveOutDate { get; set; }
+
+ public virtual Apartment Apartment { get; set; }
+ }
+}
diff --git a/ApartmentManager/HousingWebApi/Models/Resident.cs b/ApartmentManager/HousingWebApi/Models/Resident.cs
index 319a697..c9a698f 100644
--- a/ApartmentManager/HousingWebApi/Models/Resident.cs
+++ b/ApartmentManager/HousingWebApi/Models/Resident.cs
@@ -6,31 +6,30 @@ namespace HousingWebApi
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.Spatial;
+ [Table("Resident")]
public partial class Resident
{
- [Key]
- public int ResidentNr { get; set; }
+ [DatabaseGenerated(DatabaseGeneratedOption.None)]
+ public int ResidentId { get; set; }
- public int ApartmentNr { get; set; }
+ public int ApartmentId { get; set; }
- [Required]
- [StringLength(20)]
+ [StringLength(30)]
public string FirstName { get; set; }
- [Required]
- [StringLength(20)]
+ [StringLength(30)]
public string LastName { get; set; }
[Column(TypeName = "date")]
public DateTime? BirthDate { get; set; }
- public int? Phone { get; set; }
+ [StringLength(20)]
+ public string Phone { get; set; }
- [StringLength(30)]
+ [StringLength(50)]
public string Email { get; set; }
- [StringLength(220)]
- public string Picture { get; set; }
+ public byte[] Picture { get; set; }
public virtual Apartment Apartment { get; set; }
}
diff --git a/ApartmentManager/HousingWebApi/Models/ResidentList.cs b/ApartmentManager/HousingWebApi/Models/ResidentList.cs
deleted file mode 100644
index 9423bc1..0000000
--- a/ApartmentManager/HousingWebApi/Models/ResidentList.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Web;
-
-namespace HousingWebApi
-{
- public class ResidentList
- {
- public int ResidentNr { get; set; }
- public int ApartmentNr { get; set; }
- public string FirstName { get; set; }
- public string LastName { get; set; }
- public DateTime? BirthDate { get; set; }
- public int? Phone { get; set; }
- public string Email { get; set; }
- public string Picture { get; set; }
-
- }
-} \ No newline at end of file
diff --git a/ApartmentManager/HousingWebApi/Models/User.cs b/ApartmentManager/HousingWebApi/Models/User.cs
index e260ede..019e788 100644
--- a/ApartmentManager/HousingWebApi/Models/User.cs
+++ b/ApartmentManager/HousingWebApi/Models/User.cs
@@ -6,58 +6,43 @@ namespace HousingWebApi
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.Spatial;
+ [Table("User")]
public partial class User
{
[Key]
- [DatabaseGenerated(DatabaseGeneratedOption.None)]
- public int ApartmentNr { get; set; }
-
- [Required]
- [StringLength(15)]
+ [StringLength(30)]
public string Username { get; set; }
+ public int ApartmentId { get; set; }
+
[Required]
- [StringLength(15)]
+ [StringLength(30)]
public string Password { get; set; }
- [Required]
- [StringLength(1)]
- public string Type { get; set; }
+ public bool IsBm { get; set; }
- [Required]
- [StringLength(20)]
+ [StringLength(30)]
public string FirstName { get; set; }
- [Required]
- [StringLength(20)]
+ [StringLength(30)]
public string LastName { get; set; }
[Column(TypeName = "date")]
public DateTime? BirthDate { get; set; }
- [StringLength(12)]
+ [StringLength(20)]
public string Phone { get; set; }
- [StringLength(30)]
+ [StringLength(50)]
public string Email { get; set; }
- [Column(TypeName = "image")]
public byte[] Picture { get; set; }
- [StringLength(20)]
- public string SecondName { get; set; }
-
- [StringLength(20)]
- public string SecondLastName { get; set; }
-
[Column(TypeName = "date")]
- public DateTime? SecondBirthDate { get; set; }
-
- [StringLength(12)]
- public string SecondPhone { get; set; }
+ public DateTime? MoveInDate { get; set; }
- [StringLength(30)]
- public string SecondEmail { get; set; }
+ [Column(TypeName = "date")]
+ public DateTime? MoveOutDate { get; set; }
public virtual Apartment Apartment { get; set; }
}
diff --git a/ApartmentManager/HousingWebApi/Web.config b/ApartmentManager/HousingWebApi/Web.config
index 8261278..d4ce313 100644
--- a/ApartmentManager/HousingWebApi/Web.config
+++ b/ApartmentManager/HousingWebApi/Web.config
@@ -79,5 +79,6 @@
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
-
-<connectionStrings><add name="DataModel" connectionString="data source=housingdb.database.windows.net;initial catalog=housingdb;persist security info=True;user id=deltaadmin;password=Delta123!;multipleactiveresultsets=True;application name=EntityFramework" providerName="System.Data.SqlClient" /></connectionStrings></configuration> \ No newline at end of file
+ <connectionStrings>
+ <add name="DataModel" connectionString="data source=housingdb.database.windows.net;initial catalog=housingdb;persist security info=True;user id=deltaadmin;password=Delta123!;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" /></connectionStrings>
+</configuration> \ No newline at end of file
diff --git a/Diagrams/DCD.vsdx b/Diagrams/DCD.vsdx
new file mode 100644
index 0000000..9f9e57e
--- /dev/null
+++ b/Diagrams/DCD.vsdx
Binary files differ
diff --git a/Diagrams/DatabaseDiagram.vsdx b/Diagrams/DatabaseDiagram.vsdx
index e933214..7ff5ed6 100644
--- a/Diagrams/DatabaseDiagram.vsdx
+++ b/Diagrams/DatabaseDiagram.vsdx
Binary files differ
diff --git a/Diagrams/Domain Model.vsdx b/Diagrams/Domain Model.vsdx
index e34c569..bb6594e 100644
--- a/Diagrams/Domain Model.vsdx
+++ b/Diagrams/Domain Model.vsdx
Binary files differ