School Commit Init
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
|
||||
/ProfessionalProfile/bin
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using District3API.domain;
|
||||
using District3API.RepoInterfaces;
|
||||
|
||||
namespace District3API.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class AccountController : Controller
|
||||
{
|
||||
private readonly IRepoInterface<Account> _accountRepo;
|
||||
public AccountController(IRepoInterface<Account> accountRepo)
|
||||
{
|
||||
_accountRepo = accountRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAllAccounts")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_accountRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "AccountGetById")]
|
||||
[ProducesResponseType(200, Type = typeof(Account))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_accountRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "AddAccount")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] Account account)
|
||||
{
|
||||
try
|
||||
{
|
||||
_accountRepo.Add(account);
|
||||
return CreatedAtRoute("AccountGetById", new { id = account.Id }, account);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "UpdateAccount")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] Account account)
|
||||
{
|
||||
try
|
||||
{
|
||||
_accountRepo.Update(account);
|
||||
return Ok(account);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "DeleteAccount")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_accountRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using District3API.domain;
|
||||
using District3API.RepoInterfaces;
|
||||
|
||||
namespace District3API.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class BlockedProfileController : Controller
|
||||
{
|
||||
private readonly IRepoInterface<BlockedProfile> _blockedProfileRepo;
|
||||
public BlockedProfileController(IRepoInterface<BlockedProfile> blockedProfileRepo)
|
||||
{
|
||||
_blockedProfileRepo = blockedProfileRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAllBlockedProfiles")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_blockedProfileRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "BlockedProfileGetById")]
|
||||
[ProducesResponseType(200, Type = typeof(BlockedProfile))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_blockedProfileRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "AddBlockedProfile")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] BlockedProfile blockedProfile)
|
||||
{
|
||||
try
|
||||
{
|
||||
_blockedProfileRepo.Add(blockedProfile);
|
||||
return CreatedAtRoute("BlockedProfileGetById", new { id = blockedProfile.Id }, blockedProfile);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "UpdateBlockedProfile")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] BlockedProfile blockedProfile)
|
||||
{
|
||||
try
|
||||
{
|
||||
_blockedProfileRepo.Update(blockedProfile);
|
||||
return Ok(blockedProfile);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "DeleteBlockedProfile")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_blockedProfileRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using District3API.domain;
|
||||
using District3API.RepoInterfaces;
|
||||
|
||||
namespace District3API.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class CloseFriendsProfileController : Controller
|
||||
{
|
||||
private readonly IRepoInterface<CloseFriendProfile> _closeFriendsProfileRepo;
|
||||
public CloseFriendsProfileController(IRepoInterface<CloseFriendProfile> closeFriendsProfileRepo)
|
||||
{
|
||||
_closeFriendsProfileRepo = closeFriendsProfileRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAllCloseFriendsProfiles")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_closeFriendsProfileRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "CloseFriendsProfileGetById")]
|
||||
[ProducesResponseType(200, Type = typeof(CloseFriendProfile))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_closeFriendsProfileRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "AddCloseFriendsProfile")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] CloseFriendProfile closeFriendProfile)
|
||||
{
|
||||
try
|
||||
{
|
||||
_closeFriendsProfileRepo.Add(closeFriendProfile);
|
||||
return CreatedAtRoute("CloseFriendsProfileGetById", new { id = closeFriendProfile.Id }, closeFriendProfile);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "UpdateCloseFriendsProfile")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] CloseFriendProfile closeFriendProfile)
|
||||
{
|
||||
try
|
||||
{
|
||||
_closeFriendsProfileRepo.Update(closeFriendProfile);
|
||||
return Ok(closeFriendProfile);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "DeleteCloseFriendsProfile")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_closeFriendsProfileRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using District3API.domain;
|
||||
using District3API.RepoInterfaces;
|
||||
|
||||
namespace District3API.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class FancierProfileController : Controller
|
||||
{
|
||||
private readonly IRepoInterface<FancierProfile> _fancierProfileRepo;
|
||||
public FancierProfileController(IRepoInterface<FancierProfile> fancierProfileRepo)
|
||||
{
|
||||
_fancierProfileRepo = fancierProfileRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAllFancierProfiles")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_fancierProfileRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "FancierProfileGetById")]
|
||||
[ProducesResponseType(200, Type = typeof(FancierProfile))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_fancierProfileRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "AddFancierProfile")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] FancierProfile fancierProfile)
|
||||
{
|
||||
try
|
||||
{
|
||||
_fancierProfileRepo.Add(fancierProfile);
|
||||
return CreatedAtRoute("FancierProfileGetById", new { id = fancierProfile.ProfileId }, fancierProfile);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "UpdateFancierProfile")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] FancierProfile fancierProfile)
|
||||
{
|
||||
try
|
||||
{
|
||||
_fancierProfileRepo.Update(fancierProfile);
|
||||
return Ok(fancierProfile);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "DeleteFancierProfile")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_fancierProfileRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using District3API.domain;
|
||||
using District3API.RepoInterfaces;
|
||||
|
||||
namespace District3API.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class GroupController : Controller
|
||||
{
|
||||
private readonly IRepoInterface<Group> _groupRepo;
|
||||
public GroupController(IRepoInterface<Group> groupRepo)
|
||||
{
|
||||
_groupRepo = groupRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAllGroups")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_groupRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "GroupGetById")]
|
||||
[ProducesResponseType(200, Type = typeof(Group))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_groupRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "AddGroup")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] Group group)
|
||||
{
|
||||
try
|
||||
{
|
||||
_groupRepo.Add(group);
|
||||
return CreatedAtRoute("GroupGetById", new { id = group.Id }, group);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "UpdateGroup")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] Group group)
|
||||
{
|
||||
try
|
||||
{
|
||||
_groupRepo.Update(group);
|
||||
return Ok(group);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "DeleteGroup")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_groupRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using District3API.domain;
|
||||
using District3API.RepoInterfaces;
|
||||
|
||||
namespace District3API.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class HighlightController : Controller
|
||||
{
|
||||
private readonly IRepoInterface<Highlight> _highlightRepo;
|
||||
public HighlightController(IRepoInterface<Highlight> highlightRepo)
|
||||
{
|
||||
_highlightRepo = highlightRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAllHighlights")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_highlightRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "HighlightGetById")]
|
||||
[ProducesResponseType(200, Type = typeof(Highlight))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_highlightRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "AddHighlight")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] Highlight highlight)
|
||||
{
|
||||
try
|
||||
{
|
||||
_highlightRepo.Add(highlight);
|
||||
return CreatedAtRoute("HighlightGetById", new { id = highlight.HighlightId }, highlight);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "UpdateHighlight")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] Highlight highlight)
|
||||
{
|
||||
try
|
||||
{
|
||||
_highlightRepo.Update(highlight);
|
||||
return Ok(highlight);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "DeleteHighlight")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_highlightRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using District3API.domain;
|
||||
using District3API.RepoInterfaces;
|
||||
|
||||
namespace District3API.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class UserController : Controller
|
||||
{
|
||||
private readonly IRepoInterface<User> _userRepo;
|
||||
public UserController(IRepoInterface<User> userRepo)
|
||||
{
|
||||
_userRepo = userRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAllUsers")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_userRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "UserGetById")]
|
||||
[ProducesResponseType(200, Type = typeof(User))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_userRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "AddUser")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] User user)
|
||||
{
|
||||
try
|
||||
{
|
||||
_userRepo.Add(user);
|
||||
return CreatedAtRoute("GetById", new { id = user.Id }, user);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "UpdateUser")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] User user)
|
||||
{
|
||||
try
|
||||
{
|
||||
_userRepo.Update(user);
|
||||
return Ok(user);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "DeleteUser")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_userRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
using District3API.domain;
|
||||
|
||||
namespace District3API.DataBaseContext;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
public class DataContext: DbContext
|
||||
{
|
||||
public DataContext(DbContextOptions<DataContext> options) : base(options)
|
||||
{
|
||||
}
|
||||
public DbSet<Account> Account { get; set; }
|
||||
public DbSet<BlockedProfile> BlockedProfile { get; set; }
|
||||
public DbSet<CloseFriendProfile> CloseFriendProfile { get; set; }
|
||||
public DbSet<FancierProfile>? FancierProfile { get; set; }
|
||||
public DbSet<Group> Group { get; set; }
|
||||
public DbSet<Highlight> Highlight { get; set; }
|
||||
public DbSet<Post> Post { get; set; }
|
||||
public DbSet<User> User { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<Account>(account =>
|
||||
{
|
||||
account.HasKey(e => e.Id);
|
||||
account.HasOne(e => e.User)
|
||||
.WithOne()
|
||||
.HasForeignKey<Account>(e => e.UserId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
modelBuilder.Entity<BlockedProfile>(blockedProfile =>
|
||||
{
|
||||
blockedProfile.HasKey(e => e.Id);
|
||||
blockedProfile.HasOne(e => e.User)
|
||||
.WithOne()
|
||||
.HasForeignKey<BlockedProfile>(e => e.UserId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
});
|
||||
modelBuilder.Entity<CloseFriendProfile>(closeFriendProfile =>
|
||||
{
|
||||
closeFriendProfile.HasKey(e => e.Id);
|
||||
closeFriendProfile.HasOne(e => e.User)
|
||||
.WithOne()
|
||||
.HasForeignKey<CloseFriendProfile>(e => e.UserId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
modelBuilder.Entity<FancierProfile>().HasKey(x => x.ProfileId);
|
||||
modelBuilder.Entity<Group>(group =>
|
||||
{
|
||||
group.HasKey(e => e.Id);
|
||||
|
||||
});
|
||||
modelBuilder.Entity<Highlight>(highlight =>
|
||||
{
|
||||
highlight.HasKey(e => e.HighlightId);
|
||||
highlight.HasOne(e => e.User)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.UserId);
|
||||
});
|
||||
modelBuilder.Entity<Post>().HasKey(x => x.Id);
|
||||
modelBuilder.Entity<User>(user =>
|
||||
{
|
||||
user.HasKey(e => e.Id);
|
||||
user.HasOne(e => e.Group)
|
||||
.WithMany(g => g.GroupMembers)
|
||||
.HasForeignKey(e => e.GroupId);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.4"/>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ActiveDebugProfile>https</ActiveDebugProfile>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,6 @@
|
||||
@District3API_HostAddress = http://localhost:5284
|
||||
|
||||
GET {{District3API_HostAddress}}/weatherforecast/
|
||||
Accept: application/json
|
||||
|
||||
###
|
||||
@@ -0,0 +1,59 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using District3API.DataBaseContext;
|
||||
using District3API.domain;
|
||||
using District3API.RepoInterfaces;
|
||||
using District3API.Repos;
|
||||
|
||||
namespace District3API
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
|
||||
builder.Services.AddControllers();
|
||||
builder.Services.AddDbContextFactory<DataContext>(options =>
|
||||
{
|
||||
options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection"));
|
||||
|
||||
});
|
||||
builder.Services.AddScoped<IRepoInterface<Account>, AccountRepository>();
|
||||
builder.Services.AddScoped<IRepoInterface<BlockedProfile>, BlockedProfileRepository>();
|
||||
builder.Services.AddScoped<IRepoInterface<CloseFriendProfile>, CloseFriendsProfileRepository>();
|
||||
builder.Services.AddScoped<IRepoInterface<FancierProfile>, FancierProfileRepository>();
|
||||
// TODO: I do not understand why this below is not working
|
||||
builder.Services.AddScoped<IRepoInterface<Group>, GroupRepository>();
|
||||
builder.Services.AddScoped<IRepoInterface<Highlight>, HighlightRepository>();
|
||||
builder.Services.AddScoped<IRepoInterface<Post>, PostRepository>();
|
||||
builder.Services.AddScoped<IRepoInterface<User>, UserRepository>();
|
||||
|
||||
|
||||
|
||||
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
||||
}
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:34839",
|
||||
"sslPort": 44370
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "http://localhost:5281",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "https://localhost:7261;http://localhost:5281",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
namespace District3API.RepoInterfaces
|
||||
{
|
||||
public interface IRepoInterface<T>
|
||||
{
|
||||
public T GetById(int id);
|
||||
public ICollection<T> GetAll();
|
||||
public void Add(T item);
|
||||
public void Update(T item);
|
||||
public void Delete(int id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using District3API.domain;
|
||||
using District3API.DataBaseContext;
|
||||
using District3API.RepoInterfaces;
|
||||
|
||||
namespace District3API.Repos
|
||||
{
|
||||
public class AccountRepository : IRepoInterface<Account>
|
||||
{
|
||||
private readonly DataContext _context;
|
||||
|
||||
public AccountRepository(DataContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public void Add(Account item)
|
||||
{
|
||||
_context.Account.Add(item);
|
||||
_context.SaveChanges();
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
var account = _context.Account.Find(id);
|
||||
if (account != null)
|
||||
{
|
||||
_context.Account.Remove(account);
|
||||
_context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<Account> GetAll()
|
||||
{
|
||||
return _context.Account.ToList();
|
||||
}
|
||||
|
||||
public Account GetById(int id)
|
||||
{
|
||||
return _context.Account.Find(id);
|
||||
}
|
||||
|
||||
public void Update(Account item)
|
||||
{
|
||||
_context.Account.Update(item);
|
||||
_context.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
using District3API.domain;
|
||||
using District3API.DataBaseContext;
|
||||
using District3API.RepoInterfaces;
|
||||
|
||||
namespace District3API.Repos
|
||||
{
|
||||
public class BlockedProfileRepository : IRepoInterface<BlockedProfile>
|
||||
{
|
||||
private readonly DataContext _context;
|
||||
|
||||
public BlockedProfileRepository(DataContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public void Add(BlockedProfile item)
|
||||
{
|
||||
_context.BlockedProfile.Add(item);
|
||||
_context.SaveChanges();
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
var blockedProfile = _context.BlockedProfile.Find(id);
|
||||
if (blockedProfile != null)
|
||||
{
|
||||
_context.BlockedProfile.Remove(blockedProfile);
|
||||
_context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<BlockedProfile> GetAll()
|
||||
{
|
||||
return _context.BlockedProfile.ToList();
|
||||
}
|
||||
|
||||
public BlockedProfile GetById(int id)
|
||||
{
|
||||
return _context.BlockedProfile.Find(id);
|
||||
}
|
||||
|
||||
public void Update(BlockedProfile item)
|
||||
{
|
||||
_context.BlockedProfile.Update(item);
|
||||
_context.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
using District3API.domain;
|
||||
using District3API.DataBaseContext;
|
||||
using District3API.RepoInterfaces;
|
||||
|
||||
namespace District3API.Repos
|
||||
{
|
||||
public class CloseFriendsProfileRepository : IRepoInterface<CloseFriendProfile>
|
||||
{
|
||||
private readonly DataContext _context;
|
||||
|
||||
public CloseFriendsProfileRepository(DataContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public void Add(CloseFriendProfile item)
|
||||
{
|
||||
_context.CloseFriendProfile.Add(item);
|
||||
_context.SaveChanges();
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
var closeFriendProfile = _context.CloseFriendProfile.Find(id);
|
||||
if (closeFriendProfile != null)
|
||||
{
|
||||
_context.CloseFriendProfile.Remove(closeFriendProfile);
|
||||
_context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<CloseFriendProfile> GetAll()
|
||||
{
|
||||
return _context.CloseFriendProfile.ToList();
|
||||
}
|
||||
|
||||
public CloseFriendProfile GetById(int id)
|
||||
{
|
||||
return _context.CloseFriendProfile.Find(id);
|
||||
}
|
||||
|
||||
public void Update(CloseFriendProfile item)
|
||||
{
|
||||
_context.CloseFriendProfile.Update(item);
|
||||
_context.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
using District3API.domain;
|
||||
using District3API.DataBaseContext;
|
||||
using District3API.RepoInterfaces;
|
||||
|
||||
namespace District3API.Repos
|
||||
{
|
||||
public class FancierProfileRepository : IRepoInterface<FancierProfile>
|
||||
{
|
||||
private readonly DataContext _context;
|
||||
|
||||
public FancierProfileRepository(DataContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public void Add(FancierProfile item)
|
||||
{
|
||||
_context.FancierProfile.Add(item);
|
||||
_context.SaveChanges();
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
var fancierProfile = _context.FancierProfile.Find(id);
|
||||
if (fancierProfile != null)
|
||||
{
|
||||
_context.FancierProfile.Remove(fancierProfile);
|
||||
_context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<FancierProfile> GetAll()
|
||||
{
|
||||
return _context.FancierProfile.ToList();
|
||||
}
|
||||
|
||||
public FancierProfile GetById(int id)
|
||||
{
|
||||
return _context.FancierProfile.Find(id);
|
||||
}
|
||||
|
||||
public void Update(FancierProfile item)
|
||||
{
|
||||
_context.FancierProfile.Update(item);
|
||||
_context.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using District3API.domain;
|
||||
using District3API.DataBaseContext;
|
||||
using District3API.RepoInterfaces;
|
||||
|
||||
namespace District3API.Repos
|
||||
{
|
||||
public class GroupRepository : IRepoInterface<Group>
|
||||
{
|
||||
private readonly DataContext _context;
|
||||
|
||||
public GroupRepository(DataContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public void Add(Group item)
|
||||
{
|
||||
_context.Group.Add(item);
|
||||
_context.SaveChanges();
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
var group = _context.Group.Find(id);
|
||||
if (group != null)
|
||||
{
|
||||
_context.Group.Remove(group);
|
||||
_context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<Group> GetAll()
|
||||
{
|
||||
return _context.Group.ToList();
|
||||
}
|
||||
|
||||
public Group GetById(int id)
|
||||
{
|
||||
return _context.Group.Find(id);
|
||||
}
|
||||
|
||||
public void Update(Group item)
|
||||
{
|
||||
_context.Group.Update(item);
|
||||
_context.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using District3API.domain;
|
||||
using District3API.DataBaseContext;
|
||||
using District3API.RepoInterfaces;
|
||||
|
||||
namespace District3API.Repos
|
||||
{
|
||||
public class HighlightRepository : IRepoInterface<Highlight>
|
||||
{
|
||||
private readonly DataContext _context;
|
||||
|
||||
public HighlightRepository(DataContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public void Add(Highlight item)
|
||||
{
|
||||
_context.Highlight.Add(item);
|
||||
_context.SaveChanges();
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
var highlight = _context.Highlight.Find(id);
|
||||
if (highlight != null)
|
||||
{
|
||||
_context.Highlight.Remove(highlight);
|
||||
_context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<Highlight> GetAll()
|
||||
{
|
||||
return _context.Highlight.ToList();
|
||||
}
|
||||
|
||||
public Highlight GetById(int id)
|
||||
{
|
||||
return _context.Highlight.Find(id);
|
||||
}
|
||||
|
||||
public void Update(Highlight item)
|
||||
{
|
||||
_context.Highlight.Update(item);
|
||||
_context.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using District3API.domain;
|
||||
using District3API.DataBaseContext;
|
||||
using District3API.RepoInterfaces;
|
||||
|
||||
namespace District3API.Repos
|
||||
{
|
||||
public class PostRepository : IRepoInterface<Post>
|
||||
{
|
||||
private readonly DataContext _context;
|
||||
|
||||
public PostRepository(DataContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public void Add(Post item)
|
||||
{
|
||||
_context.Post.Add(item);
|
||||
_context.SaveChanges();
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
var post = _context.Post.Find(id);
|
||||
if (post != null)
|
||||
{
|
||||
_context.Post.Remove(post);
|
||||
_context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<Post> GetAll()
|
||||
{
|
||||
return _context.Post.ToList();
|
||||
}
|
||||
|
||||
public Post GetById(int id)
|
||||
{
|
||||
return _context.Post.Find(id);
|
||||
}
|
||||
|
||||
public void Update(Post item)
|
||||
{
|
||||
_context.Post.Update(item);
|
||||
_context.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using District3API.domain;
|
||||
using District3API.DataBaseContext;
|
||||
using District3API.RepoInterfaces;
|
||||
|
||||
namespace District3API.Repos
|
||||
{
|
||||
public class UserRepository : IRepoInterface<User>
|
||||
{
|
||||
private readonly DataContext _context;
|
||||
|
||||
public UserRepository(DataContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public void Add(User item)
|
||||
{
|
||||
_context.User.Add(item);
|
||||
_context.SaveChanges();
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
var user = _context.User.Find(id);
|
||||
if (user != null)
|
||||
{
|
||||
_context.User.Remove(user);
|
||||
_context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<User> GetAll()
|
||||
{
|
||||
return _context.User.ToList();
|
||||
}
|
||||
|
||||
public User GetById(int id)
|
||||
{
|
||||
return _context.User.Find(id);
|
||||
}
|
||||
|
||||
public void Update(User item)
|
||||
{
|
||||
_context.User.Update(item);
|
||||
_context.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "Data Source = VLAD-LEGIO-5PRO\\SQLEXPRESS01; Initial Catalog = iss_vlad3; Integrated Security = true; Connect Timeout=30;Encrypt=True;Trust Server Certificate=True;Application Intent=ReadWrite;Multi Subnet Failover=False"
|
||||
},
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace District3API.domain
|
||||
{
|
||||
public class Account
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string? CardNumber { get; set; }
|
||||
public string? HolderName { get; set; }
|
||||
public string? ExpirationDate{ get; set; }
|
||||
public string? Cvv { get; set; }
|
||||
public int UserId { get; set; }
|
||||
[JsonIgnore]
|
||||
public User? User { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace District3API.domain;
|
||||
|
||||
public class BlockedProfile
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int UserId { get; set; }
|
||||
[JsonIgnore]
|
||||
public User? User { get; set; }
|
||||
public DateTime BlockDate { get; set; }
|
||||
|
||||
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace District3API.domain;
|
||||
|
||||
public class CloseFriendProfile
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int UserId { get; set; }
|
||||
[JsonIgnore]
|
||||
public User? User { get; set; }
|
||||
public DateTime CloseFriendedDate { get; set; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace District3API.domain;
|
||||
|
||||
public class FancierProfile
|
||||
{
|
||||
public int ProfileId { get; set; }
|
||||
public List<string>? Links { get; set; }
|
||||
public string? DailyMotto { get; set; }
|
||||
public DateTime? RemoveMottoDate { get; set; }
|
||||
public int FrameNumber { get; set; }
|
||||
public string? Hashtag { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
namespace District3API.domain
|
||||
{
|
||||
public class Group
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string? GroupName { get; set; }
|
||||
|
||||
public List<User>? GroupMembers { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
|
||||
namespace District3API.domain
|
||||
{
|
||||
public class Highlight
|
||||
{
|
||||
public int HighlightId { get; set; }
|
||||
public int UserId { get; set; }
|
||||
[JsonIgnore]
|
||||
public User? User { get; set; }
|
||||
public List<int>? PostsIds { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public string? CoverFilePath { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace District3API.domain
|
||||
{
|
||||
public class Post
|
||||
{
|
||||
public int Id { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
|
||||
namespace District3API.domain
|
||||
{
|
||||
public class User
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string? Username { get; set; }
|
||||
public string? Password { get; set; }
|
||||
public string? Email { get; set; }
|
||||
public string? ConfirmationPassword { get; set; }
|
||||
public DateTime RegistrationDate { get; set; }
|
||||
public int FollowingCount { get; set; }
|
||||
public int FollowersCount { get; set; }
|
||||
[JsonIgnore]
|
||||
public TimeSpan UserSession { get; set; }
|
||||
public int GroupId { get; set; }
|
||||
public Group? Group { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.9.34622.214
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProfessionalProfile", "ProfessionalProfile\ProfessionalProfile.csproj", "{81B471DB-5712-4916-AA35-32A8AAEF5D3F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "District3API", "District3API\District3API.csproj", "{81F95924-E395-4985-A672-8688B9269E19}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{81B471DB-5712-4916-AA35-32A8AAEF5D3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{81B471DB-5712-4916-AA35-32A8AAEF5D3F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{81B471DB-5712-4916-AA35-32A8AAEF5D3F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{81B471DB-5712-4916-AA35-32A8AAEF5D3F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{81F95924-E395-4985-A672-8688B9269E19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{81F95924-E395-4985-A672-8688B9269E19}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{81F95924-E395-4985-A672-8688B9269E19}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{81F95924-E395-4985-A672-8688B9269E19}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {9CCDC69A-4011-42BC-9D9E-9C87D995E733}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class AnswerController : Controller
|
||||
{
|
||||
private readonly IAnswerRepo _answerRepo;
|
||||
public AnswerController(IAnswerRepo userRepo)
|
||||
{
|
||||
_answerRepo = userRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAll")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_answerRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "GetById")]
|
||||
[ProducesResponseType(200, Type = typeof(Answer))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_answerRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "Add")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] Answer answer)
|
||||
{
|
||||
try
|
||||
{
|
||||
_answerRepo.Add(answer);
|
||||
return CreatedAtRoute("GetById", new { id = answer.answerId }, answer);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "Update")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] Answer answer)
|
||||
{
|
||||
try
|
||||
{
|
||||
_answerRepo.Update(answer);
|
||||
return Ok(answer);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "Delete")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_answerRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
using ProfessionalProfile.repo;
|
||||
|
||||
namespace ProfessionalProfile.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class AssessmentTestController : Controller
|
||||
{
|
||||
private readonly IAssessmentTestRepo _assessmentTestRepo;
|
||||
public AssessmentTestController(IAssessmentTestRepo assessmentTestRepo)
|
||||
{
|
||||
_assessmentTestRepo = assessmentTestRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAllAssessmentTests")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_assessmentTestRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "AssessmentTestGetById")]
|
||||
[ProducesResponseType(200, Type = typeof(AssessmentTest))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_assessmentTestRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "AddAssessmentTest")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] AssessmentTest assessmentTest)
|
||||
{
|
||||
try
|
||||
{
|
||||
_assessmentTestRepo.Add(assessmentTest);
|
||||
return CreatedAtRoute("AssessmentTestGetById", new { id = assessmentTest.assessmentTestId }, assessmentTest);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "UpdateAssessmentTest")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] AssessmentTest assessmentTest)
|
||||
{
|
||||
try
|
||||
{
|
||||
_assessmentTestRepo.Update(assessmentTest);
|
||||
return Ok(assessmentTest);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "DeleteAssessmentTest")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_assessmentTestRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class AssessmentResultController : Controller
|
||||
{
|
||||
private readonly IAssessmentResultRepo _assessmentResultRepo;
|
||||
public AssessmentResultController(IAssessmentResultRepo assessmentResultRepo)
|
||||
{
|
||||
_assessmentResultRepo = assessmentResultRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAllAssessmentResults")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_assessmentResultRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "AssessmentResultGetById")]
|
||||
[ProducesResponseType(200, Type = typeof(AssessmentResult))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_assessmentResultRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "AddAssessmentResult")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] AssessmentResult assessmentResult)
|
||||
{
|
||||
try
|
||||
{
|
||||
_assessmentResultRepo.Add(assessmentResult);
|
||||
return CreatedAtRoute("AssessmentResultGetById", new { id = assessmentResult.assesmentResultId }, assessmentResult);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "UpdateAssessmentResult")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] AssessmentResult assessmentResult)
|
||||
{
|
||||
try
|
||||
{
|
||||
_assessmentResultRepo.Update(assessmentResult);
|
||||
return Ok(assessmentResult);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "DeleteAssessmentResult")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_assessmentResultRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class BusinessCardController : Controller
|
||||
{
|
||||
private readonly IBusinessCardRepo _businessCardRepo;
|
||||
public BusinessCardController(IBusinessCardRepo businessCardRepo)
|
||||
{
|
||||
_businessCardRepo = businessCardRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAllBusinessCards")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_businessCardRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "BusinessCardGetById")]
|
||||
[ProducesResponseType(200, Type = typeof(BusinessCard))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_businessCardRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "AddBusinessCard")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] BusinessCard businessCard)
|
||||
{
|
||||
try
|
||||
{
|
||||
_businessCardRepo.Add(businessCard);
|
||||
return CreatedAtRoute("BusinessCardGetById", new { id = businessCard.bcId }, businessCard);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "UpdateBusinessCard")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] BusinessCard businessCard)
|
||||
{
|
||||
try
|
||||
{
|
||||
_businessCardRepo.Update(businessCard);
|
||||
return Ok(businessCard);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "DeleteBusinessCard")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_businessCardRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ProfessionalProfile.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class CertificatesController : ControllerBase
|
||||
{
|
||||
private readonly ICertificateRepo _certificateRepo;
|
||||
|
||||
public CertificatesController(ICertificateRepo certificateRepo)
|
||||
{
|
||||
_certificateRepo = certificateRepo;
|
||||
}
|
||||
|
||||
// GET: api/Certificates
|
||||
[HttpGet]
|
||||
public ActionResult<IEnumerable<Certificate>> GetCertificates()
|
||||
{
|
||||
return Ok(_certificateRepo.GetAll());
|
||||
}
|
||||
|
||||
// GET: api/Certificates/5
|
||||
[HttpGet("{id}")]
|
||||
public ActionResult<Certificate> GetCertificate(int id)
|
||||
{
|
||||
var certificate = _certificateRepo.GetById(id);
|
||||
|
||||
if (certificate == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(certificate);
|
||||
}
|
||||
|
||||
// PUT: api/Certificates/5
|
||||
[HttpPut("{id}")]
|
||||
public IActionResult UpdateCertificate(int id, Certificate certificate)
|
||||
{
|
||||
if (id != certificate.certificateId)
|
||||
{
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_certificateRepo.Update(certificate);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
if (_certificateRepo.GetById(id) == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
// POST: api/Certificates
|
||||
[HttpPost]
|
||||
public ActionResult<Certificate> AddCertificate(Certificate certificate)
|
||||
{
|
||||
_certificateRepo.Add(certificate);
|
||||
|
||||
return CreatedAtAction("GetCertificate", new { id = certificate.certificateId }, certificate);
|
||||
}
|
||||
|
||||
// DELETE: api/Certificates/5
|
||||
[HttpDelete("{id}")]
|
||||
public IActionResult DeleteCertificate(int id)
|
||||
{
|
||||
var certificate = _certificateRepo.GetById(id);
|
||||
if (certificate == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
_certificateRepo.Delete(id);
|
||||
|
||||
return NoContent();
|
||||
}
|
||||
}
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class EducationController : Controller
|
||||
{
|
||||
private readonly IEducationRepo _educationRepo;
|
||||
public EducationController(IEducationRepo educationRepo)
|
||||
{
|
||||
_educationRepo = educationRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAllEducations")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_educationRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "EducationGetById")]
|
||||
[ProducesResponseType(200, Type = typeof(Education))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_educationRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "AddEducation")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] Education education)
|
||||
{
|
||||
try
|
||||
{
|
||||
_educationRepo.Add(education);
|
||||
return CreatedAtRoute("EducationGetById", new { id = education.educationId }, education);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "UpdateEducation")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] Education education)
|
||||
{
|
||||
try
|
||||
{
|
||||
_educationRepo.Update(education);
|
||||
return Ok(education);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "DeleteEducation")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_educationRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class EndorsementController : Controller
|
||||
{
|
||||
private readonly IEndorsementRepo _endorsementRepo;
|
||||
public EndorsementController(IEndorsementRepo endorsementRepo)
|
||||
{
|
||||
_endorsementRepo = endorsementRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAllEndorsements")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_endorsementRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "EndorsementGetById")]
|
||||
[ProducesResponseType(200, Type = typeof(Endorsement))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_endorsementRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "AddEndorsement")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] Endorsement endorsement)
|
||||
{
|
||||
try
|
||||
{
|
||||
_endorsementRepo.Add(endorsement);
|
||||
return CreatedAtRoute("EndorsementGetById", new { id = endorsement.endorsementId }, endorsement);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "UpdateEndorsement")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] Endorsement endorsement)
|
||||
{
|
||||
try
|
||||
{
|
||||
_endorsementRepo.Update(endorsement);
|
||||
return Ok(endorsement);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "DeleteEndorsement")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_endorsementRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class NotificationController : Controller
|
||||
{
|
||||
private readonly INotificationRepo _notificationRepo;
|
||||
public NotificationController(INotificationRepo notificationRepo)
|
||||
{
|
||||
_notificationRepo = notificationRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAllNotifications")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_notificationRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "NotificationGetById")]
|
||||
[ProducesResponseType(200, Type = typeof(Notification))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_notificationRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "AddNotification")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] Notification notification)
|
||||
{
|
||||
try
|
||||
{
|
||||
_notificationRepo.Add(notification);
|
||||
return CreatedAtRoute("NotificationGetById", new { id = notification.notificationId }, notification);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "UpdateNotification")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] Notification notification)
|
||||
{
|
||||
try
|
||||
{
|
||||
_notificationRepo.Update(notification);
|
||||
return Ok(notification);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "DeleteNotification")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_notificationRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class PrivacyController : Controller
|
||||
{
|
||||
private readonly IPrivacyRepo _privacyRepo;
|
||||
public PrivacyController(IPrivacyRepo privacyRepo)
|
||||
{
|
||||
_privacyRepo = privacyRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAllPrivacies")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_privacyRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "PrivacyGetById")]
|
||||
[ProducesResponseType(200, Type = typeof(Privacy))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_privacyRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "AddPrivacy")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] Privacy privacy)
|
||||
{
|
||||
try
|
||||
{
|
||||
_privacyRepo.Add(privacy);
|
||||
return CreatedAtRoute("PrivacyGetById", new { id = privacy.Id }, privacy);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "UpdatePrivacy")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] Privacy privacy)
|
||||
{
|
||||
try
|
||||
{
|
||||
_privacyRepo.Update(privacy);
|
||||
return Ok(privacy);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "DeletePrivacy")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_privacyRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class ProjectController : Controller
|
||||
{
|
||||
private readonly IProjectRepo _projectRepo;
|
||||
public ProjectController(IProjectRepo projectRepo)
|
||||
{
|
||||
_projectRepo = projectRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAllProjects")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_projectRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "ProjectGetById")]
|
||||
[ProducesResponseType(200, Type = typeof(Project))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_projectRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "AddProject")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] Project project)
|
||||
{
|
||||
try
|
||||
{
|
||||
_projectRepo.Add(project);
|
||||
return CreatedAtRoute("ProjectGetById", new { id = project.projectId }, project);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "UpdateProject")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] Project project)
|
||||
{
|
||||
try
|
||||
{
|
||||
_projectRepo.Update(project);
|
||||
return Ok(project);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "DeleteProject")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_projectRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class QuestionController : Controller
|
||||
{
|
||||
private readonly IQuestionRepo _questionRepo;
|
||||
public QuestionController(IQuestionRepo questionRepo)
|
||||
{
|
||||
_questionRepo = questionRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAllQuestions")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_questionRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "QuestionGetById")]
|
||||
[ProducesResponseType(200, Type = typeof(Question))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_questionRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "AddQuestion")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] Question question)
|
||||
{
|
||||
try
|
||||
{
|
||||
_questionRepo.Add(question);
|
||||
return CreatedAtRoute("QuestionGetById", new { id = question.questionId }, question);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "UpdateQuestion")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] Question question)
|
||||
{
|
||||
try
|
||||
{
|
||||
_questionRepo.Update(question);
|
||||
return Ok(question);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "DeleteQuestion")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_questionRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class SkillController : Controller
|
||||
{
|
||||
private readonly ISkillRepo _skillRepo;
|
||||
public SkillController(ISkillRepo skillRepo)
|
||||
{
|
||||
_skillRepo = skillRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAllSkills")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_skillRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "SkillGetById")]
|
||||
[ProducesResponseType(200, Type = typeof(User))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_skillRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "AddSkill")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] Skill item)
|
||||
{
|
||||
try
|
||||
{
|
||||
_skillRepo.Add(item);
|
||||
return CreatedAtRoute("GetById", new { id = item.skillId }, item);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "UpdateSkill")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] Skill item)
|
||||
{
|
||||
try
|
||||
{
|
||||
_skillRepo.Update(item);
|
||||
return Ok(item);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "DeleteSkill")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_skillRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("GetByUserId/{userId}", Name = "GetSkillsByUserId")]
|
||||
public IActionResult GetByUserId(int userId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_skillRepo.GetByUserId(userId));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("GetIdByName/{skillName}", Name = "GetIdByName")]
|
||||
public IActionResult GetIdByName(string skillName)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_skillRepo.GetIdByName(skillName));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class UserController : Controller
|
||||
{
|
||||
private readonly IUserRepoInterface _userRepo;
|
||||
public UserController(IUserRepoInterface userRepo)
|
||||
{
|
||||
_userRepo = userRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAllUsers")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_userRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "UserGetById")]
|
||||
[ProducesResponseType(200, Type = typeof(User))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_userRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "AddUser")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] User user)
|
||||
{
|
||||
try
|
||||
{
|
||||
_userRepo.Add(user);
|
||||
return CreatedAtRoute("GetById", new { id = user.userId }, user);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "UpdateUser")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] User user)
|
||||
{
|
||||
try
|
||||
{
|
||||
_userRepo.Update(user);
|
||||
return Ok(user);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "DeleteUser")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_userRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class VolunteeringController : Controller
|
||||
{
|
||||
private readonly IVolunteeringRepo _volunteeringRepo;
|
||||
public VolunteeringController(IVolunteeringRepo volunteeringRepo)
|
||||
{
|
||||
_volunteeringRepo = volunteeringRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAllVolunteerings")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_volunteeringRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "VolunteeringGetById")]
|
||||
[ProducesResponseType(200, Type = typeof(Volunteering))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_volunteeringRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "AddVolunteering")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] Volunteering volunteering)
|
||||
{
|
||||
try
|
||||
{
|
||||
_volunteeringRepo.Add(volunteering);
|
||||
return CreatedAtRoute("VolunteeringGetById", new { id = volunteering.volunteeringId }, volunteering);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "UpdateVolunteering")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] Volunteering volunteering)
|
||||
{
|
||||
try
|
||||
{
|
||||
_volunteeringRepo.Update(volunteering);
|
||||
return Ok(volunteering);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "DeleteVolunteering")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_volunteeringRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class WorkExperienceController : Controller
|
||||
{
|
||||
private readonly IWorkExperienceRepo _workExperienceRepo;
|
||||
public WorkExperienceController(IWorkExperienceRepo workExperienceRepo)
|
||||
{
|
||||
_workExperienceRepo = workExperienceRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAllWorkExperiences")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_workExperienceRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "WorkExperienceGetById")]
|
||||
[ProducesResponseType(200, Type = typeof(WorkExperience))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_workExperienceRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "AddWorkExperience")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] WorkExperience workExperience)
|
||||
{
|
||||
try
|
||||
{
|
||||
_workExperienceRepo.Add(workExperience);
|
||||
return CreatedAtRoute("WorkExperienceGetById", new { id = workExperience.workId }, workExperience);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "UpdateWorkExperience")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] WorkExperience workExperience)
|
||||
{
|
||||
try
|
||||
{
|
||||
_workExperienceRepo.Update(workExperience);
|
||||
return Ok(workExperience);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "DeleteWorkExperience")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_workExperienceRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+140
@@ -0,0 +1,140 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ProfessionalProfile.Domain;
|
||||
|
||||
namespace ProfessionalProfile.DatabaseContext
|
||||
{
|
||||
public class DataContext : DbContext
|
||||
{
|
||||
public DataContext(DbContextOptions<DataContext> options) : base(options)
|
||||
{
|
||||
}
|
||||
public DbSet<AssessmentResult> AssessmentResult { get; set; }
|
||||
public DbSet<BusinessCard> BusinessCard { get; set; }
|
||||
public DbSet<Certificate> Certificate { get; set; }
|
||||
public DbSet<Education> Education { get; set; }
|
||||
|
||||
|
||||
public DbSet<Question> Question { get; set; }
|
||||
public DbSet<Answer> Answers { get; set; }
|
||||
public DbSet<AssessmentTest> AssessmentTest { get; set; }
|
||||
public DbSet<Privacy> Privacy { get; set; }
|
||||
public DbSet<User> User { get; set; }
|
||||
public DbSet<Skill> Skill { get; set; }
|
||||
public DbSet<Endorsement> Endorsement { get; set; }
|
||||
public DbSet<Notification> Notification { get; set; }
|
||||
|
||||
public DbSet<Project> Project { get; set; }
|
||||
|
||||
public DbSet<Volunteering> Volunteering { get; set; }
|
||||
public DbSet<WorkExperience> WorkExperience { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
|
||||
|
||||
modelBuilder.Entity<Endorsement>( Endorsement =>
|
||||
{
|
||||
Endorsement.HasKey(a => a.endorsementId);
|
||||
Endorsement.HasOne(a => a.Endorser)
|
||||
.WithMany()
|
||||
.HasForeignKey(a => a.endorserId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
|
||||
Endorsement.HasOne(a => a.Recipient)
|
||||
.WithMany()
|
||||
.HasForeignKey(a => a.recipientid)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Privacy>().HasOne(a => a.User).WithOne(a => a.Privacy).HasForeignKey<Privacy>(a => a.userId);
|
||||
modelBuilder.Entity<AssessmentTest>(AssessmentTest =>
|
||||
{
|
||||
AssessmentTest.HasKey(a => a.assessmentTestId);
|
||||
AssessmentTest.HasOne(a => a.User)
|
||||
.WithMany()
|
||||
.HasForeignKey(a => a.userId);
|
||||
AssessmentTest.HasOne(a => a.Skill)
|
||||
.WithMany()
|
||||
.HasForeignKey(a => a.skillid);
|
||||
});
|
||||
modelBuilder.Entity<Question>(Question =>
|
||||
{
|
||||
Question.HasKey(a => a.questionId);
|
||||
Question.HasOne(a => a.AssessmentTest)
|
||||
.WithMany()
|
||||
.HasForeignKey(a => a.assesmentTestId);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Answer>(Answer =>
|
||||
{
|
||||
Answer.HasKey(a => a.answerId);
|
||||
Answer.HasOne(a => a.Question)
|
||||
.WithMany()
|
||||
.HasForeignKey(a => a.questionId);
|
||||
});
|
||||
modelBuilder.Entity<Education>(Education =>
|
||||
{
|
||||
|
||||
Education.HasKey(a => a.educationId);
|
||||
Education.HasOne(a => a.User)
|
||||
.WithMany()
|
||||
.HasForeignKey(a => a.userId);
|
||||
});
|
||||
modelBuilder.Entity<Certificate>(Certificate =>
|
||||
{
|
||||
Certificate.HasKey(a => a.certificateId);
|
||||
Certificate.HasOne(a => a.User)
|
||||
.WithMany()
|
||||
.HasForeignKey(a => a.userId);
|
||||
});
|
||||
modelBuilder.Entity<BusinessCard>(BussinesCard =>
|
||||
{
|
||||
BussinesCard.HasKey(a => a.bcId);
|
||||
modelBuilder.Entity<BusinessCard>()
|
||||
.HasMany(bc => bc.keySkills)
|
||||
.WithOne();
|
||||
|
||||
});
|
||||
modelBuilder.Entity<AssessmentResult>(AssessmentResult =>
|
||||
{
|
||||
AssessmentResult.HasKey(a => a.assesmentResultId);
|
||||
AssessmentResult.HasOne(a => a.AssessmentTest)
|
||||
.WithOne(a => a.AssessmentResult)
|
||||
.HasForeignKey<AssessmentResult>(a => a.assesmentTestId).OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
AssessmentResult.HasOne(a => a.User)
|
||||
.WithOne(a => a.AssessmentResult).HasForeignKey<AssessmentResult>(a => a.userId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
|
||||
});
|
||||
modelBuilder.Entity<Project>(Project =>
|
||||
{
|
||||
Project.HasKey(a => a.projectId);
|
||||
Project.HasOne(a => a.User)
|
||||
.WithOne(a => a.Project)
|
||||
.HasForeignKey<Project>(b => b.userId);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Volunteering>(Volunteering =>
|
||||
{
|
||||
Volunteering.HasKey(a => a.volunteeringId);
|
||||
Volunteering.HasOne(a => a.User)
|
||||
.WithOne(a => a.Volunteering)
|
||||
.HasForeignKey<Volunteering>(a=>a.userId);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<WorkExperience>(WorkExperience =>
|
||||
{
|
||||
WorkExperience.HasKey(a => a.workId);
|
||||
WorkExperience.HasOne(a => a.User)
|
||||
.WithOne(a => a.WorkExperience)
|
||||
.HasForeignKey<WorkExperience>(a => a.userId);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Repo;
|
||||
|
||||
namespace ProfessionalProfile.Interfaces
|
||||
{
|
||||
public interface IAnswerRepo
|
||||
{
|
||||
public Answer GetById(int id);
|
||||
public ICollection<Answer> GetAll();
|
||||
public void Add(Answer item);
|
||||
public void Update(Answer item);
|
||||
public void Delete(int id);
|
||||
ICollection<Answer> GetAnswers(int questionId);
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
using ProfessionalProfile.Domain;
|
||||
|
||||
namespace ProfessionalProfile.Interfaces
|
||||
{
|
||||
public interface IAssessmentResultRepo
|
||||
{
|
||||
public AssessmentResult GetById(int id);
|
||||
public ICollection<AssessmentResult> GetAll();
|
||||
public void Add(AssessmentResult item);
|
||||
public void Update(AssessmentResult item);
|
||||
public void Delete(int id);
|
||||
public ICollection<AssessmentResult> GetAssessmentResultsByUserId(int userId);
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
using ProfessionalProfile.Domain;
|
||||
|
||||
namespace ProfessionalProfile.Interfaces
|
||||
{
|
||||
public interface IAssessmentTestRepo
|
||||
{
|
||||
public AssessmentTest GetById(int id);
|
||||
public ICollection<AssessmentTest> GetAll();
|
||||
public void Add(AssessmentTest item);
|
||||
public void Update(AssessmentTest item);
|
||||
public void Delete(int id);
|
||||
public int GetIdByName(string testName);
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
using ProfessionalProfile.Domain;
|
||||
|
||||
namespace ProfessionalProfile.Interfaces
|
||||
{
|
||||
public interface IBusinessCardRepo
|
||||
{
|
||||
public BusinessCard GetById(int id);
|
||||
public ICollection<BusinessCard> GetAll();
|
||||
public void Add(BusinessCard item);
|
||||
public void Update(BusinessCard item);
|
||||
public void Delete(int id);
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
using ProfessionalProfile.Domain;
|
||||
|
||||
namespace ProfessionalProfile.Interfaces
|
||||
{
|
||||
public interface ICertificateRepo
|
||||
{
|
||||
public Certificate GetById(int id);
|
||||
public ICollection<Certificate> GetAll();
|
||||
public void Add(Certificate item);
|
||||
public void Update(Certificate item);
|
||||
public void Delete(int id);
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
using ProfessionalProfile.Domain;
|
||||
|
||||
namespace ProfessionalProfile.Interfaces
|
||||
{
|
||||
public interface IEducationRepo
|
||||
{
|
||||
public Education GetById(int id);
|
||||
public ICollection<Education> GetAll();
|
||||
public void Add(Education item);
|
||||
public void Update(Education item);
|
||||
public void Delete(int id);
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
using ProfessionalProfile.Domain;
|
||||
|
||||
namespace ProfessionalProfile.Interfaces
|
||||
{
|
||||
public interface IEndorsementRepo
|
||||
{
|
||||
public Endorsement GetById(int id);
|
||||
public ICollection<Endorsement> GetAll();
|
||||
public void Add(Endorsement item);
|
||||
public void Update(Endorsement item);
|
||||
public void Delete(int id);
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
using ProfessionalProfile.Domain;
|
||||
|
||||
namespace ProfessionalProfile.Interfaces
|
||||
{
|
||||
public interface INotificationRepo
|
||||
{
|
||||
public Notification GetById(int id);
|
||||
public ICollection<Notification> GetAll();
|
||||
public void Add(Notification item);
|
||||
public void Update(Notification item);
|
||||
public void Delete(int id);
|
||||
public List<Notification> GetAllByUserId(int userId);
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
using ProfessionalProfile.Domain;
|
||||
|
||||
namespace ProfessionalProfile.Interfaces
|
||||
{
|
||||
public interface IPrivacyRepo
|
||||
{
|
||||
public Privacy GetById(int id);
|
||||
public ICollection<Privacy> GetAll();
|
||||
public void Add(Privacy item);
|
||||
public void Update(Privacy item);
|
||||
public void Delete(int id);
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
using ProfessionalProfile.Domain;
|
||||
|
||||
namespace ProfessionalProfile.Interfaces
|
||||
{
|
||||
public interface IProjectRepo
|
||||
{
|
||||
public Project GetById(int id);
|
||||
public ICollection<Project> GetAll();
|
||||
public void Add(Project item);
|
||||
public void Update(Project item);
|
||||
public void Delete(int id);
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
using ProfessionalProfile.Domain;
|
||||
|
||||
namespace ProfessionalProfile.Interfaces
|
||||
{
|
||||
public interface IQuestionRepo
|
||||
{
|
||||
public Question GetById(int id);
|
||||
public ICollection<Question> GetAll();
|
||||
public void Add(Question item);
|
||||
public void Update(Question item);
|
||||
public void Delete(int id);
|
||||
public int GetIdByNameAndAssessmentId(string questionName, int assessmentId);
|
||||
public List<Question> GetAllByTestId(int testId);
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
using ProfessionalProfile.Domain;
|
||||
|
||||
namespace ProfessionalProfile.Interfaces
|
||||
{
|
||||
public interface ISkillRepo
|
||||
{
|
||||
public Skill GetById(int id);
|
||||
public ICollection<Skill> GetAll();
|
||||
public void Add(Skill item);
|
||||
public void Update(Skill item);
|
||||
public void Delete(int id);
|
||||
public List<Skill> GetByUserId(int userId);
|
||||
public int GetIdByName(string name);
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
using ProfessionalProfile.Domain;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Interfaces
|
||||
{
|
||||
public interface IUserRepoInterface
|
||||
{
|
||||
public User GetById(int id);
|
||||
public ICollection<User> GetAll();
|
||||
public void Add(User item);
|
||||
public void Update(User item);
|
||||
public void Delete(int id);
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
using ProfessionalProfile.Domain;
|
||||
|
||||
namespace ProfessionalProfile.Interfaces
|
||||
{
|
||||
public interface IVolunteeringRepo
|
||||
{
|
||||
public Volunteering GetById(int id);
|
||||
public ICollection<Volunteering> GetAll();
|
||||
public void Add(Volunteering item);
|
||||
public void Update(Volunteering item);
|
||||
public void Delete(int id);
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
using ProfessionalProfile.Domain;
|
||||
|
||||
namespace ProfessionalProfile.Interfaces
|
||||
{
|
||||
public interface IWorkExperienceRepo
|
||||
{
|
||||
public WorkExperience GetById(int id);
|
||||
public ICollection<WorkExperience> GetAll();
|
||||
public void Add(WorkExperience item);
|
||||
public void Update(WorkExperience item);
|
||||
public void Delete(int id);
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Repo
|
||||
{
|
||||
public interface IRepoInterface<T>
|
||||
{
|
||||
public T GetById(int id);
|
||||
public ICollection<T> GetAll();
|
||||
public void Add(T item);
|
||||
public void Update(T item);
|
||||
public void Delete(int id);
|
||||
}
|
||||
}
|
||||
+728
@@ -0,0 +1,728 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using ProfessionalProfile.DatabaseContext;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ProfessionalProfile.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
[Migration("20240514164956_UwU")]
|
||||
partial class UwU
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.4")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Answer", b =>
|
||||
{
|
||||
b.Property<int>("answerId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("answerId"));
|
||||
|
||||
b.Property<string>("answerText")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("isCorrect")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("questionId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("answerId");
|
||||
|
||||
b.HasIndex("questionId");
|
||||
|
||||
b.ToTable("Answers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.AssessmentResult", b =>
|
||||
{
|
||||
b.Property<int>("assesmentResultId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("assesmentResultId"));
|
||||
|
||||
b.Property<int>("assesmentTestId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("score")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("testDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("assesmentResultId");
|
||||
|
||||
b.HasIndex("assesmentTestId")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("userId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("AssessmentResult");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.AssessmentTest", b =>
|
||||
{
|
||||
b.Property<int>("assessmentTestId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("assessmentTestId"));
|
||||
|
||||
b.Property<string>("description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("skillid")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("testName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("assessmentTestId");
|
||||
|
||||
b.HasIndex("skillid");
|
||||
|
||||
b.HasIndex("userId");
|
||||
|
||||
b.ToTable("AssessmentTest");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.BusinessCard", b =>
|
||||
{
|
||||
b.Property<int>("bcId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("bcId"));
|
||||
|
||||
b.Property<string>("summary")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("uniqueUrl")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("bcId");
|
||||
|
||||
b.HasIndex("userId");
|
||||
|
||||
b.ToTable("BusinessCard");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Certificate", b =>
|
||||
{
|
||||
b.Property<int>("certificateId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("certificateId"));
|
||||
|
||||
b.Property<string>("description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("expirationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("issuedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("issuedDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("certificateId");
|
||||
|
||||
b.HasIndex("userId");
|
||||
|
||||
b.ToTable("Certificate");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Education", b =>
|
||||
{
|
||||
b.Property<int>("educationId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("educationId"));
|
||||
|
||||
b.Property<string>("degree")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("fieldOfStudy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("graduationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("institution")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("educationId");
|
||||
|
||||
b.HasIndex("userId");
|
||||
|
||||
b.ToTable("Education");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Endorsement", b =>
|
||||
{
|
||||
b.Property<int>("endorsementId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("endorsementId"));
|
||||
|
||||
b.Property<int>("endorserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("recipientid")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("skillId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("endorsementId");
|
||||
|
||||
b.HasIndex("endorserId");
|
||||
|
||||
b.HasIndex("recipientid");
|
||||
|
||||
b.HasIndex("skillId");
|
||||
|
||||
b.ToTable("Endorsement");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Notification", b =>
|
||||
{
|
||||
b.Property<int>("notificationId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("notificationId"));
|
||||
|
||||
b.Property<string>("activity")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("details")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("isRead")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime>("timestamp")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("notificationId");
|
||||
|
||||
b.HasIndex("userId");
|
||||
|
||||
b.ToTable("Notification");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Privacy", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("CanViewCertificates")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("CanViewEducation")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("CanViewProjects")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("CanViewSkills")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("CanViewVolunteering")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("CanViewWorkExperience")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("userId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Privacy");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Project", b =>
|
||||
{
|
||||
b.Property<int>("projectId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("projectId"));
|
||||
|
||||
b.Property<string>("description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("projectName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("technologies")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("projectId");
|
||||
|
||||
b.HasIndex("userId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Project");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Question", b =>
|
||||
{
|
||||
b.Property<int>("questionId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("questionId"));
|
||||
|
||||
b.Property<int>("assesmentTestId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("questionText")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("questionId");
|
||||
|
||||
b.HasIndex("assesmentTestId");
|
||||
|
||||
b.ToTable("Question");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Skill", b =>
|
||||
{
|
||||
b.Property<int>("skillId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("skillId"));
|
||||
|
||||
b.Property<int?>("BusinessCardbcId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("skillId");
|
||||
|
||||
b.HasIndex("BusinessCardbcId");
|
||||
|
||||
b.ToTable("Skill");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.User", b =>
|
||||
{
|
||||
b.Property<int>("userId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("userId"));
|
||||
|
||||
b.Property<string>("address")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("darkTheme")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime>("dateOfBirth")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("firstName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("lastName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("picture")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("summary")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("websiteURL")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("userId");
|
||||
|
||||
b.ToTable("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Volunteering", b =>
|
||||
{
|
||||
b.Property<int>("volunteeringId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("volunteeringId"));
|
||||
|
||||
b.Property<string>("description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("organisation")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("role")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("volunteeringId");
|
||||
|
||||
b.HasIndex("userId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Volunteering");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.WorkExperience", b =>
|
||||
{
|
||||
b.Property<int>("workId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("workId"));
|
||||
|
||||
b.Property<string>("achievements")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("company")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("employmentPeriod")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("jobTitle")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("location")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("responsibilities")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("workId");
|
||||
|
||||
b.HasIndex("userId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("WorkExperience");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Answer", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.Question", "Question")
|
||||
.WithMany()
|
||||
.HasForeignKey("questionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Question");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.AssessmentResult", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.AssessmentTest", "AssessmentTest")
|
||||
.WithOne("AssessmentResult")
|
||||
.HasForeignKey("ProfessionalProfile.Domain.AssessmentResult", "assesmentTestId")
|
||||
.OnDelete(DeleteBehavior.NoAction)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithOne("AssessmentResult")
|
||||
.HasForeignKey("ProfessionalProfile.Domain.AssessmentResult", "userId")
|
||||
.OnDelete(DeleteBehavior.NoAction)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AssessmentTest");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.AssessmentTest", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.Skill", "Skill")
|
||||
.WithMany()
|
||||
.HasForeignKey("skillid")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Skill");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.BusinessCard", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Certificate", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Education", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Endorsement", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "Endorser")
|
||||
.WithMany()
|
||||
.HasForeignKey("endorserId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "Recipient")
|
||||
.WithMany()
|
||||
.HasForeignKey("recipientid")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ProfessionalProfile.Domain.Skill", null)
|
||||
.WithMany("endorsements")
|
||||
.HasForeignKey("skillId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Endorser");
|
||||
|
||||
b.Navigation("Recipient");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Notification", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithMany("Notifications")
|
||||
.HasForeignKey("userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Privacy", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithOne("Privacy")
|
||||
.HasForeignKey("ProfessionalProfile.Domain.Privacy", "userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Project", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithOne("Project")
|
||||
.HasForeignKey("ProfessionalProfile.Domain.Project", "userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Question", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.AssessmentTest", "AssessmentTest")
|
||||
.WithMany()
|
||||
.HasForeignKey("assesmentTestId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AssessmentTest");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Skill", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.BusinessCard", null)
|
||||
.WithMany("keySkills")
|
||||
.HasForeignKey("BusinessCardbcId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Volunteering", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithOne("Volunteering")
|
||||
.HasForeignKey("ProfessionalProfile.Domain.Volunteering", "userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.WorkExperience", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithOne("WorkExperience")
|
||||
.HasForeignKey("ProfessionalProfile.Domain.WorkExperience", "userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.AssessmentTest", b =>
|
||||
{
|
||||
b.Navigation("AssessmentResult")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.BusinessCard", b =>
|
||||
{
|
||||
b.Navigation("keySkills");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Skill", b =>
|
||||
{
|
||||
b.Navigation("endorsements");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.User", b =>
|
||||
{
|
||||
b.Navigation("AssessmentResult");
|
||||
|
||||
b.Navigation("Notifications");
|
||||
|
||||
b.Navigation("Privacy");
|
||||
|
||||
b.Navigation("Project");
|
||||
|
||||
b.Navigation("Volunteering");
|
||||
|
||||
b.Navigation("WorkExperience");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
+516
@@ -0,0 +1,516 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ProfessionalProfile.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class UwU : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "User",
|
||||
columns: table => new
|
||||
{
|
||||
userId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
firstName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
lastName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
password = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
phone = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
summary = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
dateOfBirth = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
darkTheme = table.Column<bool>(type: "bit", nullable: false),
|
||||
address = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
websiteURL = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
picture = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_User", x => x.userId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "BusinessCard",
|
||||
columns: table => new
|
||||
{
|
||||
bcId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
userId = table.Column<int>(type: "int", nullable: false),
|
||||
summary = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
uniqueUrl = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_BusinessCard", x => x.bcId);
|
||||
table.ForeignKey(
|
||||
name: "FK_BusinessCard_User_userId",
|
||||
column: x => x.userId,
|
||||
principalTable: "User",
|
||||
principalColumn: "userId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Certificate",
|
||||
columns: table => new
|
||||
{
|
||||
certificateId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
issuedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
description = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
issuedDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
expirationDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
userId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Certificate", x => x.certificateId);
|
||||
table.ForeignKey(
|
||||
name: "FK_Certificate_User_userId",
|
||||
column: x => x.userId,
|
||||
principalTable: "User",
|
||||
principalColumn: "userId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Education",
|
||||
columns: table => new
|
||||
{
|
||||
educationId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
userId = table.Column<int>(type: "int", nullable: false),
|
||||
degree = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
institution = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
fieldOfStudy = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
graduationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Education", x => x.educationId);
|
||||
table.ForeignKey(
|
||||
name: "FK_Education_User_userId",
|
||||
column: x => x.userId,
|
||||
principalTable: "User",
|
||||
principalColumn: "userId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Notification",
|
||||
columns: table => new
|
||||
{
|
||||
notificationId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
userId = table.Column<int>(type: "int", nullable: false),
|
||||
activity = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
timestamp = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
details = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
isRead = table.Column<bool>(type: "bit", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Notification", x => x.notificationId);
|
||||
table.ForeignKey(
|
||||
name: "FK_Notification_User_userId",
|
||||
column: x => x.userId,
|
||||
principalTable: "User",
|
||||
principalColumn: "userId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Privacy",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
userId = table.Column<int>(type: "int", nullable: false),
|
||||
CanViewEducation = table.Column<bool>(type: "bit", nullable: false),
|
||||
CanViewWorkExperience = table.Column<bool>(type: "bit", nullable: false),
|
||||
CanViewSkills = table.Column<bool>(type: "bit", nullable: false),
|
||||
CanViewProjects = table.Column<bool>(type: "bit", nullable: false),
|
||||
CanViewCertificates = table.Column<bool>(type: "bit", nullable: false),
|
||||
CanViewVolunteering = table.Column<bool>(type: "bit", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Privacy", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Privacy_User_userId",
|
||||
column: x => x.userId,
|
||||
principalTable: "User",
|
||||
principalColumn: "userId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Project",
|
||||
columns: table => new
|
||||
{
|
||||
projectId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
projectName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
description = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
technologies = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
userId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Project", x => x.projectId);
|
||||
table.ForeignKey(
|
||||
name: "FK_Project_User_userId",
|
||||
column: x => x.userId,
|
||||
principalTable: "User",
|
||||
principalColumn: "userId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Volunteering",
|
||||
columns: table => new
|
||||
{
|
||||
volunteeringId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
userId = table.Column<int>(type: "int", nullable: false),
|
||||
organisation = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
role = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
description = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Volunteering", x => x.volunteeringId);
|
||||
table.ForeignKey(
|
||||
name: "FK_Volunteering_User_userId",
|
||||
column: x => x.userId,
|
||||
principalTable: "User",
|
||||
principalColumn: "userId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "WorkExperience",
|
||||
columns: table => new
|
||||
{
|
||||
workId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
userId = table.Column<int>(type: "int", nullable: false),
|
||||
jobTitle = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
company = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
location = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
employmentPeriod = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
responsibilities = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
achievements = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
description = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_WorkExperience", x => x.workId);
|
||||
table.ForeignKey(
|
||||
name: "FK_WorkExperience_User_userId",
|
||||
column: x => x.userId,
|
||||
principalTable: "User",
|
||||
principalColumn: "userId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Skill",
|
||||
columns: table => new
|
||||
{
|
||||
skillId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
BusinessCardbcId = table.Column<int>(type: "int", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Skill", x => x.skillId);
|
||||
table.ForeignKey(
|
||||
name: "FK_Skill_BusinessCard_BusinessCardbcId",
|
||||
column: x => x.BusinessCardbcId,
|
||||
principalTable: "BusinessCard",
|
||||
principalColumn: "bcId");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AssessmentTest",
|
||||
columns: table => new
|
||||
{
|
||||
assessmentTestId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
testName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
userId = table.Column<int>(type: "int", nullable: false),
|
||||
description = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
skillid = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AssessmentTest", x => x.assessmentTestId);
|
||||
table.ForeignKey(
|
||||
name: "FK_AssessmentTest_Skill_skillid",
|
||||
column: x => x.skillid,
|
||||
principalTable: "Skill",
|
||||
principalColumn: "skillId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_AssessmentTest_User_userId",
|
||||
column: x => x.userId,
|
||||
principalTable: "User",
|
||||
principalColumn: "userId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Endorsement",
|
||||
columns: table => new
|
||||
{
|
||||
endorsementId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
endorserId = table.Column<int>(type: "int", nullable: false),
|
||||
recipientid = table.Column<int>(type: "int", nullable: false),
|
||||
skillId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Endorsement", x => x.endorsementId);
|
||||
table.ForeignKey(
|
||||
name: "FK_Endorsement_Skill_skillId",
|
||||
column: x => x.skillId,
|
||||
principalTable: "Skill",
|
||||
principalColumn: "skillId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Endorsement_User_endorserId",
|
||||
column: x => x.endorserId,
|
||||
principalTable: "User",
|
||||
principalColumn: "userId",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_Endorsement_User_recipientid",
|
||||
column: x => x.recipientid,
|
||||
principalTable: "User",
|
||||
principalColumn: "userId",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AssessmentResult",
|
||||
columns: table => new
|
||||
{
|
||||
assesmentResultId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
assesmentTestId = table.Column<int>(type: "int", nullable: false),
|
||||
score = table.Column<int>(type: "int", nullable: false),
|
||||
userId = table.Column<int>(type: "int", nullable: false),
|
||||
testDate = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AssessmentResult", x => x.assesmentResultId);
|
||||
table.ForeignKey(
|
||||
name: "FK_AssessmentResult_AssessmentTest_assesmentTestId",
|
||||
column: x => x.assesmentTestId,
|
||||
principalTable: "AssessmentTest",
|
||||
principalColumn: "assessmentTestId");
|
||||
table.ForeignKey(
|
||||
name: "FK_AssessmentResult_User_userId",
|
||||
column: x => x.userId,
|
||||
principalTable: "User",
|
||||
principalColumn: "userId");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Question",
|
||||
columns: table => new
|
||||
{
|
||||
questionId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
questionText = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
assesmentTestId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Question", x => x.questionId);
|
||||
table.ForeignKey(
|
||||
name: "FK_Question_AssessmentTest_assesmentTestId",
|
||||
column: x => x.assesmentTestId,
|
||||
principalTable: "AssessmentTest",
|
||||
principalColumn: "assessmentTestId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Answers",
|
||||
columns: table => new
|
||||
{
|
||||
answerId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
answerText = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
questionId = table.Column<int>(type: "int", nullable: false),
|
||||
isCorrect = table.Column<bool>(type: "bit", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Answers", x => x.answerId);
|
||||
table.ForeignKey(
|
||||
name: "FK_Answers_Question_questionId",
|
||||
column: x => x.questionId,
|
||||
principalTable: "Question",
|
||||
principalColumn: "questionId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Answers_questionId",
|
||||
table: "Answers",
|
||||
column: "questionId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AssessmentResult_assesmentTestId",
|
||||
table: "AssessmentResult",
|
||||
column: "assesmentTestId",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AssessmentResult_userId",
|
||||
table: "AssessmentResult",
|
||||
column: "userId",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AssessmentTest_skillid",
|
||||
table: "AssessmentTest",
|
||||
column: "skillid");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AssessmentTest_userId",
|
||||
table: "AssessmentTest",
|
||||
column: "userId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BusinessCard_userId",
|
||||
table: "BusinessCard",
|
||||
column: "userId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Certificate_userId",
|
||||
table: "Certificate",
|
||||
column: "userId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Education_userId",
|
||||
table: "Education",
|
||||
column: "userId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Endorsement_endorserId",
|
||||
table: "Endorsement",
|
||||
column: "endorserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Endorsement_recipientid",
|
||||
table: "Endorsement",
|
||||
column: "recipientid");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Endorsement_skillId",
|
||||
table: "Endorsement",
|
||||
column: "skillId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Notification_userId",
|
||||
table: "Notification",
|
||||
column: "userId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Privacy_userId",
|
||||
table: "Privacy",
|
||||
column: "userId",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Project_userId",
|
||||
table: "Project",
|
||||
column: "userId",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Question_assesmentTestId",
|
||||
table: "Question",
|
||||
column: "assesmentTestId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Skill_BusinessCardbcId",
|
||||
table: "Skill",
|
||||
column: "BusinessCardbcId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Volunteering_userId",
|
||||
table: "Volunteering",
|
||||
column: "userId",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorkExperience_userId",
|
||||
table: "WorkExperience",
|
||||
column: "userId",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Answers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AssessmentResult");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Certificate");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Education");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Endorsement");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Notification");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Privacy");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Project");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Volunteering");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "WorkExperience");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Question");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AssessmentTest");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Skill");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "BusinessCard");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "User");
|
||||
}
|
||||
}
|
||||
}
|
||||
+725
@@ -0,0 +1,725 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using ProfessionalProfile.DatabaseContext;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ProfessionalProfile.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
partial class DataContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.4")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Answer", b =>
|
||||
{
|
||||
b.Property<int>("answerId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("answerId"));
|
||||
|
||||
b.Property<string>("answerText")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("isCorrect")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("questionId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("answerId");
|
||||
|
||||
b.HasIndex("questionId");
|
||||
|
||||
b.ToTable("Answers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.AssessmentResult", b =>
|
||||
{
|
||||
b.Property<int>("assesmentResultId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("assesmentResultId"));
|
||||
|
||||
b.Property<int>("assesmentTestId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("score")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("testDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("assesmentResultId");
|
||||
|
||||
b.HasIndex("assesmentTestId")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("userId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("AssessmentResult");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.AssessmentTest", b =>
|
||||
{
|
||||
b.Property<int>("assessmentTestId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("assessmentTestId"));
|
||||
|
||||
b.Property<string>("description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("skillid")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("testName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("assessmentTestId");
|
||||
|
||||
b.HasIndex("skillid");
|
||||
|
||||
b.HasIndex("userId");
|
||||
|
||||
b.ToTable("AssessmentTest");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.BusinessCard", b =>
|
||||
{
|
||||
b.Property<int>("bcId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("bcId"));
|
||||
|
||||
b.Property<string>("summary")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("uniqueUrl")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("bcId");
|
||||
|
||||
b.HasIndex("userId");
|
||||
|
||||
b.ToTable("BusinessCard");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Certificate", b =>
|
||||
{
|
||||
b.Property<int>("certificateId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("certificateId"));
|
||||
|
||||
b.Property<string>("description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("expirationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("issuedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("issuedDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("certificateId");
|
||||
|
||||
b.HasIndex("userId");
|
||||
|
||||
b.ToTable("Certificate");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Education", b =>
|
||||
{
|
||||
b.Property<int>("educationId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("educationId"));
|
||||
|
||||
b.Property<string>("degree")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("fieldOfStudy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("graduationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("institution")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("educationId");
|
||||
|
||||
b.HasIndex("userId");
|
||||
|
||||
b.ToTable("Education");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Endorsement", b =>
|
||||
{
|
||||
b.Property<int>("endorsementId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("endorsementId"));
|
||||
|
||||
b.Property<int>("endorserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("recipientid")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("skillId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("endorsementId");
|
||||
|
||||
b.HasIndex("endorserId");
|
||||
|
||||
b.HasIndex("recipientid");
|
||||
|
||||
b.HasIndex("skillId");
|
||||
|
||||
b.ToTable("Endorsement");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Notification", b =>
|
||||
{
|
||||
b.Property<int>("notificationId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("notificationId"));
|
||||
|
||||
b.Property<string>("activity")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("details")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("isRead")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime>("timestamp")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("notificationId");
|
||||
|
||||
b.HasIndex("userId");
|
||||
|
||||
b.ToTable("Notification");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Privacy", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("CanViewCertificates")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("CanViewEducation")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("CanViewProjects")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("CanViewSkills")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("CanViewVolunteering")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("CanViewWorkExperience")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("userId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Privacy");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Project", b =>
|
||||
{
|
||||
b.Property<int>("projectId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("projectId"));
|
||||
|
||||
b.Property<string>("description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("projectName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("technologies")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("projectId");
|
||||
|
||||
b.HasIndex("userId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Project");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Question", b =>
|
||||
{
|
||||
b.Property<int>("questionId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("questionId"));
|
||||
|
||||
b.Property<int>("assesmentTestId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("questionText")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("questionId");
|
||||
|
||||
b.HasIndex("assesmentTestId");
|
||||
|
||||
b.ToTable("Question");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Skill", b =>
|
||||
{
|
||||
b.Property<int>("skillId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("skillId"));
|
||||
|
||||
b.Property<int?>("BusinessCardbcId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("skillId");
|
||||
|
||||
b.HasIndex("BusinessCardbcId");
|
||||
|
||||
b.ToTable("Skill");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.User", b =>
|
||||
{
|
||||
b.Property<int>("userId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("userId"));
|
||||
|
||||
b.Property<string>("address")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("darkTheme")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime>("dateOfBirth")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("firstName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("lastName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("picture")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("summary")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("websiteURL")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("userId");
|
||||
|
||||
b.ToTable("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Volunteering", b =>
|
||||
{
|
||||
b.Property<int>("volunteeringId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("volunteeringId"));
|
||||
|
||||
b.Property<string>("description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("organisation")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("role")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("volunteeringId");
|
||||
|
||||
b.HasIndex("userId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Volunteering");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.WorkExperience", b =>
|
||||
{
|
||||
b.Property<int>("workId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("workId"));
|
||||
|
||||
b.Property<string>("achievements")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("company")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("employmentPeriod")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("jobTitle")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("location")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("responsibilities")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("workId");
|
||||
|
||||
b.HasIndex("userId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("WorkExperience");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Answer", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.Question", "Question")
|
||||
.WithMany()
|
||||
.HasForeignKey("questionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Question");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.AssessmentResult", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.AssessmentTest", "AssessmentTest")
|
||||
.WithOne("AssessmentResult")
|
||||
.HasForeignKey("ProfessionalProfile.Domain.AssessmentResult", "assesmentTestId")
|
||||
.OnDelete(DeleteBehavior.NoAction)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithOne("AssessmentResult")
|
||||
.HasForeignKey("ProfessionalProfile.Domain.AssessmentResult", "userId")
|
||||
.OnDelete(DeleteBehavior.NoAction)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AssessmentTest");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.AssessmentTest", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.Skill", "Skill")
|
||||
.WithMany()
|
||||
.HasForeignKey("skillid")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Skill");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.BusinessCard", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Certificate", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Education", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Endorsement", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "Endorser")
|
||||
.WithMany()
|
||||
.HasForeignKey("endorserId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "Recipient")
|
||||
.WithMany()
|
||||
.HasForeignKey("recipientid")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ProfessionalProfile.Domain.Skill", null)
|
||||
.WithMany("endorsements")
|
||||
.HasForeignKey("skillId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Endorser");
|
||||
|
||||
b.Navigation("Recipient");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Notification", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithMany("Notifications")
|
||||
.HasForeignKey("userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Privacy", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithOne("Privacy")
|
||||
.HasForeignKey("ProfessionalProfile.Domain.Privacy", "userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Project", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithOne("Project")
|
||||
.HasForeignKey("ProfessionalProfile.Domain.Project", "userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Question", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.AssessmentTest", "AssessmentTest")
|
||||
.WithMany()
|
||||
.HasForeignKey("assesmentTestId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AssessmentTest");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Skill", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.BusinessCard", null)
|
||||
.WithMany("keySkills")
|
||||
.HasForeignKey("BusinessCardbcId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Volunteering", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithOne("Volunteering")
|
||||
.HasForeignKey("ProfessionalProfile.Domain.Volunteering", "userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.WorkExperience", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithOne("WorkExperience")
|
||||
.HasForeignKey("ProfessionalProfile.Domain.WorkExperience", "userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.AssessmentTest", b =>
|
||||
{
|
||||
b.Navigation("AssessmentResult")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.BusinessCard", b =>
|
||||
{
|
||||
b.Navigation("keySkills");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Skill", b =>
|
||||
{
|
||||
b.Navigation("endorsements");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.User", b =>
|
||||
{
|
||||
b.Navigation("AssessmentResult");
|
||||
|
||||
b.Navigation("Notifications");
|
||||
|
||||
b.Navigation("Privacy");
|
||||
|
||||
b.Navigation("Project");
|
||||
|
||||
b.Navigation("Volunteering");
|
||||
|
||||
b.Navigation("WorkExperience");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.2" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<_ContentIncludedByDefault Remove="Views\Shared\_ValidationScriptsPartial.cshtml" />
|
||||
<_ContentIncludedByDefault Remove="Views\Skills\Create.cshtml" />
|
||||
<_ContentIncludedByDefault Remove="Views\Skills\Delete.cshtml" />
|
||||
<_ContentIncludedByDefault Remove="Views\Skills\Details.cshtml" />
|
||||
<_ContentIncludedByDefault Remove="Views\Skills\Edit.cshtml" />
|
||||
<_ContentIncludedByDefault Remove="Views\Skills\Index.cshtml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Controllers-District3\" />
|
||||
<Folder Include="DataBaseContext-District3\" />
|
||||
<Folder Include="domain-District3\" />
|
||||
<Folder Include="RepoInterface-District3\" />
|
||||
<Folder Include="Repos-District3\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ActiveDebugProfile>https</ActiveDebugProfile>
|
||||
<Controller_SelectedScaffolderID>MvcControllerWithContextScaffolder</Controller_SelectedScaffolderID>
|
||||
<Controller_SelectedScaffolderCategoryPath>root/Common/MVC/Controller</Controller_SelectedScaffolderCategoryPath>
|
||||
<WebStackScaffolding_ControllerDialogWidth>650</WebStackScaffolding_ControllerDialogWidth>
|
||||
<WebStackScaffolding_IsLayoutPageSelected>True</WebStackScaffolding_IsLayoutPageSelected>
|
||||
<WebStackScaffolding_IsPartialViewSelected>False</WebStackScaffolding_IsPartialViewSelected>
|
||||
<WebStackScaffolding_IsReferencingScriptLibrariesSelected>True</WebStackScaffolding_IsReferencingScriptLibrariesSelected>
|
||||
<WebStackScaffolding_LayoutPageFile />
|
||||
<WebStackScaffolding_DbContextTypeFullName>ProfessionalProfile.DatabaseContext.DataContext</WebStackScaffolding_DbContextTypeFullName>
|
||||
<WebStackScaffolding_IsAsyncSelected>False</WebStackScaffolding_IsAsyncSelected>
|
||||
<WebStackScaffolding_IsViewGenerationSelected>True</WebStackScaffolding_IsViewGenerationSelected>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
@ProfessionalProfile_HostAddress = http://localhost:5148
|
||||
|
||||
GET {{ProfessionalProfile_HostAddress}}/weatherforecast/
|
||||
Accept: application/json
|
||||
|
||||
###
|
||||
@@ -0,0 +1,65 @@
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ProfessionalProfile.DatabaseContext;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
using ProfessionalProfile.repo;
|
||||
using ProfessionalProfile.Repo;
|
||||
|
||||
|
||||
namespace ProfessionalProfile
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
|
||||
builder.Services.AddControllers();
|
||||
builder.Services.AddDbContextFactory<DataContext>(options =>
|
||||
{
|
||||
options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection"));
|
||||
|
||||
});
|
||||
builder.Services.AddSingleton<IAnswerRepo, AnswerRepo>();
|
||||
builder.Services.AddSingleton<IAssessmentResultRepo, AssessmentResultRepo>();
|
||||
builder.Services.AddSingleton<IAssessmentTestRepo, AssessmentTestRepo>();
|
||||
builder.Services.AddSingleton<IBusinessCardRepo, BusinessCardRepo>();
|
||||
builder.Services.AddSingleton<ICertificateRepo, CertificateRepo>();
|
||||
builder.Services.AddSingleton<IEducationRepo, EducationRepo>();
|
||||
builder.Services.AddSingleton<IEndorsementRepo, EndorsementRepo>();
|
||||
builder.Services.AddSingleton<INotificationRepo, NotificationRepo>();
|
||||
builder.Services.AddSingleton<IPrivacyRepo, PrivacyRepo>();
|
||||
builder.Services.AddSingleton<IProjectRepo, ProjectRepo>();
|
||||
builder.Services.AddSingleton<IQuestionRepo, QuestionRepo>();
|
||||
builder.Services.AddSingleton<ISkillRepo, SkillRepo>();
|
||||
builder.Services.AddSingleton<IUserRepoInterface, UserRepo>();
|
||||
builder.Services.AddSingleton<IVolunteeringRepo, VolunteeringRepo>();
|
||||
builder.Services.AddSingleton<IWorkExperienceRepo, WorkExperienceRepo>();
|
||||
|
||||
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
||||
}
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:2832",
|
||||
"sslPort": 44306
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "http://localhost:5148",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "https://localhost:7241;http://localhost:5148",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace ProfessionalProfile
|
||||
{
|
||||
public class WeatherForecast
|
||||
{
|
||||
public DateOnly Date { get; set; }
|
||||
|
||||
public int TemperatureC { get; set; }
|
||||
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
|
||||
public string? Summary { get; set; }
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "Data Source =DESKTOP-IO9FIG6\\SQLEXPRESS; Initial Catalog = UwU; Integrated Security = true; Connect Timeout=30;Encrypt=True;Trust Server Certificate=True;Application Intent=ReadWrite;Multi Subnet Failover=False"
|
||||
},
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class Answer
|
||||
{
|
||||
public int answerId { get; set; }
|
||||
public string answerText { get; set; }
|
||||
public int questionId { get; set; }
|
||||
public bool isCorrect { get; set; }
|
||||
|
||||
// Navigation properties
|
||||
[JsonIgnore]
|
||||
public virtual Question? Question { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class AnswerDTO
|
||||
{
|
||||
public string AnswerText { get; set; }
|
||||
public bool IsCorrect { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class AssessmentResult
|
||||
{
|
||||
public int assesmentResultId { get; set; }
|
||||
public int assesmentTestId { get; set; }
|
||||
public int score { get; set; }
|
||||
public int userId { get; set; }
|
||||
public DateTime testDate { get; set; }
|
||||
|
||||
//Navigation properties
|
||||
[JsonIgnore]
|
||||
public AssessmentTest ?AssessmentTest { get; set; }
|
||||
[JsonIgnore]
|
||||
|
||||
public User ?User { get; set; }
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class AssessmentTest
|
||||
{
|
||||
public int assessmentTestId { get; set;}
|
||||
public string testName { get; set; }
|
||||
public int userId { get; set; }
|
||||
public string description { get; set; }
|
||||
public int skillid { get; set; }
|
||||
|
||||
// Navigation properties
|
||||
[JsonIgnore]
|
||||
public virtual User ?User { get; set; }
|
||||
[JsonIgnore]
|
||||
|
||||
public virtual Skill ?Skill { get; set; }
|
||||
[JsonIgnore]
|
||||
|
||||
public virtual AssessmentResult ?AssessmentResult { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class AssessmentTestDTO
|
||||
{
|
||||
public string TestName { get; set; }
|
||||
public string Description { get; set; }
|
||||
public List<QuestionDTO> Questions { get; set; }
|
||||
public string SkillTested { get; set; }
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class BusinessCard
|
||||
{
|
||||
public int bcId { get; set;}
|
||||
public int userId { get; set; }
|
||||
public string summary { get; set; }
|
||||
public string uniqueUrl { get; set; }
|
||||
|
||||
//Navigation properties
|
||||
[JsonIgnore]
|
||||
public User ?User { get; set; }
|
||||
[JsonIgnore]
|
||||
public ICollection<Skill> ?keySkills { get; set; }
|
||||
}
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class Certificate
|
||||
{
|
||||
public int certificateId { get; set; }
|
||||
public string name { get; set; }
|
||||
public string issuedBy { get; set; }
|
||||
public string description { get; set; }
|
||||
public DateTime issuedDate { get; set; }
|
||||
public DateTime expirationDate { get; set; }
|
||||
public int userId { get; set; }
|
||||
|
||||
// Navigation properties
|
||||
[JsonIgnore]
|
||||
public virtual User? User { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class Education
|
||||
{
|
||||
public int educationId { get; set;}
|
||||
public int userId { get; set; }
|
||||
public string degree { get; set; }
|
||||
public string institution { get; set; }
|
||||
public string fieldOfStudy { get; set; }
|
||||
public DateTime graduationDate { get; set; }
|
||||
public double gPA;
|
||||
// Navigation properties
|
||||
[JsonIgnore]
|
||||
public virtual User ?User { get; set; }
|
||||
}
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class Endorsement
|
||||
{
|
||||
|
||||
public int endorsementId { get; set; }
|
||||
public int endorserId { get; set; }
|
||||
public int recipientid { get; set; }
|
||||
public int skillId { get; set; }
|
||||
|
||||
//navigation properties
|
||||
[JsonIgnore]
|
||||
public virtual User? Endorser { get; set; }
|
||||
[JsonIgnore]
|
||||
public virtual User? Recipient { get; set; }
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class Notification
|
||||
{
|
||||
[Key]
|
||||
public int notificationId { get; set;}
|
||||
public int userId { get; set; }
|
||||
public string activity { get; set; }
|
||||
public DateTime timestamp { get; set; }
|
||||
public string details { get; set; }
|
||||
public bool isRead { get; set; }
|
||||
|
||||
// Navigation properties
|
||||
[JsonIgnore]
|
||||
public User? User { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class Privacy
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
public int userId { get; set; }
|
||||
public bool CanViewEducation { get; set; }
|
||||
public bool CanViewWorkExperience { get; set; }
|
||||
public bool CanViewSkills { get; set; }
|
||||
public bool CanViewProjects { get; set; }
|
||||
public bool CanViewCertificates { get; set; }
|
||||
public bool CanViewVolunteering { get; set; }
|
||||
|
||||
//navigation properties
|
||||
[JsonIgnore]
|
||||
public virtual User? User { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class Project
|
||||
{
|
||||
public int projectId { get; set;}
|
||||
public string projectName { get; set; }
|
||||
public string description { get; set; }
|
||||
public string technologies { get; set; }
|
||||
public int userId { get; set; }
|
||||
|
||||
//Navigation properties
|
||||
[JsonIgnore]
|
||||
public User? User { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class Question
|
||||
{
|
||||
public int questionId { get; set; }
|
||||
public string questionText { get; set; }
|
||||
public int assesmentTestId { get; set; }
|
||||
|
||||
// Navigation properties
|
||||
[JsonIgnore]
|
||||
public virtual AssessmentTest ?AssessmentTest { get; set; }
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class QuestionDTO
|
||||
{
|
||||
public string QuestionText { get; set; }
|
||||
public List<AnswerDTO> Answers { get; set; }
|
||||
public AnswerDTO CorrectAnswer { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class Skill
|
||||
{
|
||||
public int skillId { get; set;}
|
||||
public string name { get; set; }
|
||||
|
||||
|
||||
//navigation property
|
||||
[JsonIgnore]
|
||||
public ICollection<Endorsement>? endorsements { get; set;}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class User
|
||||
{
|
||||
public int userId { get; set; }
|
||||
public string firstName { get; set; }
|
||||
public string lastName { get; set; }
|
||||
public string email { get; set; }
|
||||
public string password { get; set; }
|
||||
public string phone { get; set; }
|
||||
public string summary { get; set; }
|
||||
public DateTime dateOfBirth { get; set; }
|
||||
public bool darkTheme { get; set; }
|
||||
public string address { get; set; }
|
||||
public string websiteURL { get; set; }
|
||||
public string picture { get; set; }
|
||||
|
||||
// Navigation property for one-to-one relationship
|
||||
[JsonIgnore]
|
||||
public Privacy? Privacy { get; set; }
|
||||
[JsonIgnore]
|
||||
public ICollection<Notification>? Notifications { get; set; }
|
||||
[JsonIgnore]
|
||||
public AssessmentResult? AssessmentResult { get; set; }
|
||||
[JsonIgnore]
|
||||
public Project? Project { get; set; }
|
||||
[JsonIgnore]
|
||||
public Volunteering? Volunteering { get; set; }
|
||||
[JsonIgnore]
|
||||
public WorkExperience? WorkExperience { get; set; }
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class Volunteering
|
||||
{
|
||||
public int volunteeringId { get; set; }
|
||||
public int userId { get; set; }
|
||||
public string organisation { get; set; }
|
||||
public string role { get; set; }
|
||||
public string description { get; set; }
|
||||
|
||||
//Navigation properties
|
||||
[JsonIgnore]
|
||||
public User? User { get; set; }
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class WorkExperience
|
||||
{
|
||||
public int workId { get; set; }
|
||||
public int userId { get; set; }
|
||||
public string jobTitle { get; set; }
|
||||
public string company { get; set; }
|
||||
public string location { get; set; }
|
||||
public string employmentPeriod { get; set; }
|
||||
public string responsibilities { get; set; }
|
||||
public string achievements { get; set; }
|
||||
public string description { get; set; }
|
||||
|
||||
//Navigation properties
|
||||
[JsonIgnore]
|
||||
public User? User { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ProfessionalProfile.DatabaseContext;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.repo
|
||||
{
|
||||
public class AnswerRepo : IAnswerRepo
|
||||
{
|
||||
private readonly IDbContextFactory<DataContext> _contextFactory;
|
||||
public AnswerRepo(IDbContextFactory<DataContext> contextFactory)
|
||||
{
|
||||
_contextFactory = contextFactory;
|
||||
}
|
||||
public void Add(Answer item)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.Answers.Add(item);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
var answer = context.Answers.Find(id);
|
||||
context.Answers.Remove(answer);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<Answer> GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.Answers.ToList();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public Answer GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.Answers.Find(id);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(Answer answer)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.Answers.Update(answer);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<Answer> GetAnswers(int QuestionId)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.Answers.Where(x => x.questionId == QuestionId).ToList();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ProfessionalProfile.DatabaseContext;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.repo
|
||||
{
|
||||
public class AssessmentResultRepo : IAssessmentResultRepo
|
||||
{
|
||||
private readonly IDbContextFactory<DataContext> _contextFactory;
|
||||
|
||||
public AssessmentResultRepo(IDbContextFactory<DataContext> contextFactory)
|
||||
{
|
||||
_contextFactory = contextFactory;
|
||||
}
|
||||
public void Add(AssessmentResult item)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.AssessmentResult.Add(item);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
var assessmentResult = context.AssessmentResult.Find(id);
|
||||
context.AssessmentResult.Remove(assessmentResult);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<AssessmentResult> GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.AssessmentResult.ToList();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public AssessmentResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.AssessmentResult.Find(id);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(AssessmentResult assessmentResult)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.AssessmentResult.Update(assessmentResult);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<AssessmentResult> GetAssessmentResultsByUserId(int userId)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.AssessmentResult.Where(x => x.userId == userId).ToList();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ProfessionalProfile.DatabaseContext;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.repo
|
||||
{
|
||||
public class AssessmentTestRepo : IAssessmentTestRepo
|
||||
{
|
||||
private readonly IDbContextFactory<DataContext> _contextFactory;
|
||||
public AssessmentTestRepo(IDbContextFactory<DataContext> contextFactory)
|
||||
{
|
||||
_contextFactory = contextFactory;
|
||||
}
|
||||
public void Add(AssessmentTest item)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.AssessmentTest.Add(item);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
var assessmentTest = context.AssessmentTest.Find(id);
|
||||
context.AssessmentTest.Remove(assessmentTest);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<AssessmentTest> GetAll()
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.AssessmentTest.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public AssessmentTest GetById(int id)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.AssessmentTest.Find(id);
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(AssessmentTest assessmentTest)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.AssessmentTest.Update(assessmentTest);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
public int GetIdByName(string testName)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.AssessmentTest.Where(x => x.testName == testName).Select(x => x.assessmentTestId).FirstOrDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ProfessionalProfile.DatabaseContext;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.repo
|
||||
{
|
||||
public class BusinessCardRepo : IBusinessCardRepo
|
||||
{
|
||||
private readonly IDbContextFactory<DataContext> _contextFactory;
|
||||
public BusinessCardRepo(IDbContextFactory<DataContext> contextFactory)
|
||||
{
|
||||
_contextFactory = contextFactory;
|
||||
}
|
||||
public void Add(BusinessCard item)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.BusinessCard.Add(item);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
var businessCard = context.BusinessCard.Find(id);
|
||||
context.BusinessCard.Remove(businessCard);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<BusinessCard> GetAll()
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.BusinessCard.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public BusinessCard GetById(int id)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.BusinessCard.Find(id);
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(BusinessCard businessCard)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.BusinessCard.Update(businessCard);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ProfessionalProfile.DatabaseContext;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace ProfessionalProfile.repo
|
||||
{
|
||||
public class CertificateRepo : ICertificateRepo
|
||||
{
|
||||
private readonly IDbContextFactory<DataContext> _contextFactory;
|
||||
|
||||
public CertificateRepo(IDbContextFactory<DataContext> contextFactory)
|
||||
{
|
||||
_contextFactory = contextFactory;
|
||||
}
|
||||
|
||||
public void Add(Certificate item)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.Certificate.Add(item);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
var certificate = context.Certificate.Find(id);
|
||||
context.Certificate.Remove(certificate);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<Certificate> GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.Certificate.ToList();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public Certificate GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.Certificate.Find(id);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(Certificate certificate)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.Certificate.Update(certificate);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user