user login, register, hashed passwords, announcements start

This commit is contained in:
Dimitar Byalkov
2023-03-29 11:29:25 +02:00
parent e296205466
commit f858c47ff7
27 changed files with 623 additions and 125 deletions

View File

@@ -5,37 +5,29 @@ using System.Text;
namespace StudentHouseDashboard.Models
{
public class Announcement : IMessage, IVotable
public class Announcement : GenericMessage, IVotable
{
public Announcement(User author, string description, string title, DateTime publishDate, bool isImportant, bool isSticky) : base(author, description, title, publishDate)
{
IsImportant = isImportant;
IsSticky = isSticky;
}
public List<Comment> Comments
{
get => default;
set
{
}
get;set;
}
public int IsImportant
public bool IsImportant
{
get => default;
set
{
}
get;set;
}
public int IsSticky
public bool IsSticky
{
get => default;
set
{
}
get; set;
}
public string Title { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public string Description { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public User Author { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public DateTime PublishDate { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public void DownVote()
{
throw new NotImplementedException();

View File

@@ -5,19 +5,11 @@ using System.Text;
namespace StudentHouseDashboard.Models
{
public class Comment : IMessage, IVotable
public class Comment : GenericMessage, IVotable
{
public int Responses
public Comment(User author, string description, string title, DateTime publishDate) : base(author, description, title, publishDate)
{
get => default;
set
{
}
}
public string Title { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public string Description { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public User Author { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public DateTime PublishDate { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public void DownVote()
{

View File

@@ -5,27 +5,27 @@ using System.Text;
namespace StudentHouseDashboard.Models
{
public class Complaint : IMessage
public class Complaint : GenericMessage
{
public Complaint(User author, string description, string title, DateTime publishDate, ComplaintStatus status, ComplaintSeverity severity) : base(author, description, title, publishDate)
{
Status = status;
Severity = severity;
}
public ComplaintStatus Status
{
get => default;
set
{
}
get;set;
}
public ComplaintSeverity Severity
{
get => default;
set
{
}
get;set;
}
public string Title { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public string Description { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public User Author { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public DateTime PublishDate { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public List<Comment> Responses
{
get;set;
}
}
}

View File

@@ -5,37 +5,22 @@ using System.Text;
namespace StudentHouseDashboard.Models
{
public class Event : IMessage, IVotable
public class Event : GenericMessage
{
public int StartDate
public Event(User author, string description, string title, DateTime publishDate, DateTime startDate, DateTime endDate) : base(author, description, title, publishDate)
{
get => default;
set
{
}
StartDate = startDate;
EndDate = endDate;
}
public int EndDate
public DateTime StartDate
{
get => default;
set
{
}
get;set;
}
public string Title { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public string Description { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public User Author { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public DateTime PublishDate { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public void DownVote()
public DateTime EndDate
{
throw new NotImplementedException();
}
public void UpVote()
{
throw new NotImplementedException();
get;set;
}
}
}

View File

@@ -0,0 +1,45 @@
using StudentHouseDashboard.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace StudentHouseDashboard
{
public abstract class GenericMessage
{
private User author;
private string description;
private string title;
private DateTime publishDate;
protected GenericMessage(User author, string description, string title, DateTime publishDate)
{
Author = author;
Description = description;
Title = title;
PublishDate = publishDate;
}
public User Author
{
get => author;
set => author = value;
}
public string Description
{
get => description;
set => description = value;
}
public string Title
{
get => title;
set => title = value;
}
public DateTime PublishDate
{
get => publishDate;
set => publishDate = value;
}
}
}

View File

@@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace StudentHouseDashboard.Models
{
public interface IMessage
{
string Title { get; set; }
string Description { get; set; }
User Author { get; set; }
DateTime PublishDate { get; set; }
}
}

View File

@@ -7,7 +7,13 @@ namespace StudentHouseDashboard.Models
{
public interface IVotable
{
void UpVote();
void DownVote();
void UpVote()
{
throw new NotImplementedException();
}
void DownVote()
{
throw new NotImplementedException();
}
}
}

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
@@ -7,20 +8,42 @@ namespace StudentHouseDashboard.Models
{
public class User
{
public User(int username, UserRole role)
private int id;
private string name;
private string password;
private UserRole role;
public User(int id, string name, string password, UserRole role)
{
Username = username;
Id = id;
Name = name;
Password = password;
Role = role;
}
public int Username
public User()
{
get;set;
}
public int Id
{
get; private set;
}
public string Name
{
get => name;
set => name = value;
}
[PasswordPropertyText(true)]
public string Password
{
get => password;
set => password = value;
}
public UserRole Role
{
get;set;
get => role;
set => role = value;
}
}
}