Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
groupH_M32COM/Code/groupH_M32COM.Angular/Controllers/EventController.cs
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
58 lines (52 sloc)
1.4 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using groupH_M32COM.Angular.DatabaseClasses; | |
using groupH_M32COM.Angular.DTO; | |
using Microsoft.AspNetCore.Authorization; | |
using Microsoft.AspNetCore.Http; | |
using Microsoft.AspNetCore.Mvc; | |
namespace groupH_M32COM.Angular.Controllers | |
{ | |
[Route("api/[controller]")] | |
[ApiController] | |
public class EventController : ControllerBase | |
{ | |
private RCBoatDBContext _context; | |
private RCBoatRepository repo; | |
public EventController(RCBoatDBContext context) | |
{ | |
this._context = context; | |
this.repo = new RCBoatRepository(context); | |
} | |
// GET: api/Event | |
//[Authorize] | |
[HttpGet] | |
public IEnumerable<EventsDTO> Get() | |
{ | |
return this.repo.GetAllEventDTO().ToList(); | |
} | |
// GET: api/Event/5 | |
[HttpGet("{id}", Name = "Get")] | |
public EventsDTO Get(int id) | |
{ | |
return this.repo.GetEventDTO(id); | |
} | |
// POST: api/Event | |
[HttpPost] | |
public void Post([FromBody] string value) | |
{ | |
} | |
// PUT: api/Event/5 | |
[HttpPut("{id}")] | |
public void Put(int id, [FromBody] string value) | |
{ | |
} | |
// DELETE: api/ApiWithActions/5 | |
[HttpDelete("{id}")] | |
public void Delete(int id) | |
{ | |
} | |
} | |
} |