Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Data/IUserTasksManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace UserTasksManager.Data
{
interface IUserTasksManager
{

}
}
11 changes: 11 additions & 0 deletions Data/UserTasksContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace UserTasksManager.Data
{
public class UserTasksContext
{
}
}
22 changes: 22 additions & 0 deletions Models/Profile.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;

namespace UserTasksManager.Models
{
public enum Role
{
Developer,
Manager
}
public class Profile : User
{
[Required(ErrorMessage = "Role is Required (must be Developer or Manager)")]
public Role role { get; set; }
//Tasks
public ICollection<Task> tasks { get; set; }

}
}
57 changes: 57 additions & 0 deletions Models/Task.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;

namespace UserTasksManager.Models
{
public class Task
{
public enum State
{
ToDO,
InDevelopment,
InCodeReview,
Testing,
Done
}
public int Id { get; set; }
[Required(ErrorMessage = "Your task must hava a title")]
public string Title { get; set; }
[DataType(DataType.MultilineText)]
public string Description { get; set; }
private DateTime startDate;
public DateTime StartDate
{
get { return startDate; }
set { startDate = DateTime.Now; }
}
[Required(ErrorMessage = "End Date is Required!")]
[DataType(DataType.Date)]
private string endDate;
public string EndDate
{
get { return endDate; }
set
{
DateTime parsedDate;
var isValidFormat = DateTime.TryParseExact(value,"MM/dd/yyyy HH:mm:ss", new CultureInfo("en-US"), DateTimeStyles.None, out parsedDate);
if (isValidFormat)
{
endDate = value;
}
else
{
endDate = "Invalid";
}
}
}
[Range(0, float.MaxValue, ErrorMessage = "Please enter valid float Number")]
public float Estimate { get; set; }
public State Status { get; set; }
//Profile
public ICollection<Profile> profiles { get; set; }
}
}
39 changes: 39 additions & 0 deletions Models/User.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;

namespace UserTasksManager.Models
{
public class User
{
[Key] // optional !
public int Id { get; set; }
[Required(ErrorMessage = "UserName is required")]
public string UserName { get; set; }
[Required(ErrorMessage = "Password is required")]
[DataType(DataType.Password)]
[RegularExpression("^((?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])|(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[^a-zA-Z0-9])|(?=.*?[A-Z])(?=.*?[0-9])(?=.*?[^a-zA-Z0-9])|(?=.*?[a-z])(?=.*?[0-9])(?=.*?[^a-zA-Z0-9])).{8,}$"
, ErrorMessage = "Passwords must be at least 8 characters and contain at 3 of 4 of the following: upper case (A-Z), lower case (a-z), number (0-9) and special character (e.g. !@#$%^&*)")]
public string Password { get; set; }
[NotMapped] //Confirm Password will not be added to DB
[Required(ErrorMessage = "Confirm Password is required")]
[DataType(DataType.Password)]
[Compare("Password", ErrorMessage = "Password and Confirmation Password must match.")]
public string ConfirmPassword { get; set; }
[Required(ErrorMessage = "Email is required")]
// data annotation to validate email in C#
[EmailAddress(ErrorMessage = "Enter a valid Email address")]
public string Email { get; set; }
private DateTime dateCreated;

public DateTime DateCreated
{
get { return dateCreated; }
set { dateCreated = DateTime.Now; }
}

}
}
4 changes: 4 additions & 0 deletions Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using UserTasksManager.Models;

namespace UserTasksManager
{
Expand All @@ -25,6 +26,9 @@ public Startup(IConfiguration configuration)
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
//les services tels que le contexte de base de donn�es doivent �tre inscrits aupr�s du conteneur d�injection de d�pendances.
//Le conteneur fournit le service aux contr�leurs.

services.AddControllers();
}

Expand Down
12 changes: 10 additions & 2 deletions UserTasksManager.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Folder Include="Controllers\" />
<Folder Include="Models\" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.7">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.7" />
</ItemGroup>

<ProjectExtensions><VisualStudio><UserProperties properties_4launchsettings_1json__JsonSchema="" /></VisualStudio></ProjectExtensions>
Expand Down