School Commit Init
This commit is contained in:
+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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user