Last active
September 3, 2020 19:09
-
-
Save laribee/0dbf2167fe63cf15ca2befb2764d1021 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
[HttpPost] | |
public IActionResult Post(CreateEventDto m) | |
{ | |
var organizer = new OrganizersService().GetOrganizerDetails( new AuthenticationService().GetCurrentUser()); | |
if (m.Description == null) throw new ArgumentException(); | |
if (m.Title == null) throw new ArgumentException(); | |
if (m.Starts > m.Ends) | |
{ | |
throw new ArgumentException(); | |
} | |
if (m.Status == "Published") | |
{ | |
if (m.Starts < DateTime.Now) | |
{ | |
throw new ArgumentException(); | |
} | |
if (m.Capacity <= 0) throw new ArgumentException(); | |
if (m.Tickets.Capacity != m.Capacity) throw new ArgumentException(); | |
decimal pr = m.Tickets.Capacity * m.Tickets.Cost; | |
m.PotentialRevenue = pr; | |
new EventListingManager().Notify(m); | |
} | |
new DataAccessLayer().Save(m); | |
return Ok(); | |
} | |
private decimal CalculatePotentialRevenue(CreateEventDto createEventDto) | |
{ | |
return (createEventDto.Tickets.Capacity * createEventDto.Tickets.Cost); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment