Skip to content
Permalink
Browse files
Created linking table
  • Loading branch information
ChrisRollings committed Mar 23, 2019
1 parent af2f7b3 commit 2bf5d8640a23f092f5240c8442a3bc98840533cc
Show file tree
Hide file tree
Showing 18 changed files with 259 additions and 955 deletions.
@@ -14,14 +14,16 @@ namespace groupH_M32COM.Angular.Controllers
[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]
//[Authorize]
[HttpGet]
public IEnumerable<EventsDTO> Get()
{
@@ -0,0 +1,14 @@
-- Script Date: 23/03/2019 12:33 - ErikEJ.SqlCeScripting version 3.5.2.80
DROP TABLE [__EFMigrationsHistory];
DROP TABLE [Boats];
DROP TABLE [CrewMembers];
DROP TABLE [EventPrizes];
DROP TABLE [Events];
DROP TABLE [Promotions];
DROP TABLE [Sponsorships];
DROP TABLE [Locations];

DROP TABLE [EventDetailBoat];
DROP TABLE [EventDetailPrizes];
DROP TABLE [EventDetailPromotion];

@@ -17,22 +17,22 @@ namespace groupH_M32COM.Angular.DTO
public int LocationID { get; set; }
public BoatModel EventType { get; set; }
public List<Promotion> Promotions { get; set; }
public List<EventPrizes> Notes { get; set; }
public List<EventPrize> Notes { get; set; }
public List<BoatDTO> RegisterdBoats { get; set; }
public BoatDTO WinningBoat { get; set; }

public void Inflate(EventDetail eventDetails,RCBoatRepository repo)
public void Inflate(Event eventDetails,RCBoatRepository repo)
{
this.ID = eventDetails.ID;
this.Description = eventDetails.Description;
this.StartDate = eventDetails.StartDate;
this.EndDate = eventDetails.End_Date;
this.Location = eventDetails.Location;
this.EventType = eventDetails.EventType;
this.Promotions = eventDetails.Promotions.ToList();
this.Notes = eventDetails.Prizes.ToList();
this.RegisterdBoats = eventDetails.RegisterdBoats.Select(x => { var boat = new BoatDTO();boat.Inflate(x); return boat; }).ToList();
this.WinningBoat = repo.GetBoatDTO(eventDetails.WinningBoatId);
//this.Promotions = eventDetails.Promotions.ToList();
//this.Notes = eventDetails.Prizes.ToList();
//this.RegisterdBoats = eventDetails.Boats.Select(x => { var boat = new BoatDTO();boat.Inflate(x); return boat; }).ToList();
//this.WinningBoat = repo.GetBoatDTO(eventDetails.WinningBoatId);
}
}
}

0 comments on commit 2bf5d86

Please sign in to comment.