public Organization addOrganization(Organization organization) { DbContext.Add(organization); DbContext.SaveChanges(); return(organization); }
public User registerUser(string email, string password, Organization organization) { User user = new User(); user.Contact.Email = email; user.Password = password; user.Organization = organization; DbContext.Add(user); DbContext.SaveChanges(); return(user); }
public BiletiEvent addEvent(BiletiEvent biletiEvent) { var organization = DbContext.Organizations.Where(x => x.Id == biletiEvent.Organization.Id).FirstOrDefault(); biletiEvent.Organization = organization; var venue = DbContext.Venues.Where(x => x.Id == biletiEvent.Venue.Id).FirstOrDefault(); biletiEvent.Venue = venue; DbContext.Add(biletiEvent); DbContext.SaveChanges(); return(biletiEvent); }
public Ticket addTicket(Ticket ticket) { var bEvent = DbContext.BiletiEvents.Where(x => x.Id == ticket.Event.Id).FirstOrDefault(); ticket.Event = bEvent; var seat = DbContext.Seats.Where(x => x.Id == ticket.Seat.Id).FirstOrDefault(); ticket.Seat = seat; DbContext.Add(ticket); Transaction transaction = new Transaction(); transaction.Ticket = ticket; transaction.TransactionStatus = TransactionStatus.Available; DbContext.Transactions.Add(transaction); DbContext.SaveChanges(); return(ticket); }