public BiletiEvent updateEvent(BiletiEvent biletiEvent) { DbContext.Update(biletiEvent); DbContext.SaveChanges(); return(biletiEvent); }
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 bool deleteEvent(Guid id) { BiletiEvent biletiEvent = DbContext.BiletiEvents.Where(x => x.Id == id).FirstOrDefault(); if (biletiEvent != null) { DbContext.Remove(biletiEvent); DbContext.SaveChanges(); return(true); } return(false); }
public ActionResult <BiletiEvent> updateEvent([FromBody] BiletiEvent biletiEvent) { try { if (biletiEvent == null) { return(BadRequest("Event object is null")); } return(_eventService.updateEvent(biletiEvent)); } catch (Exception) { return(StatusCode(500, "Internal server error")); } }
public ActionResult <BiletiEvent> addEvent([FromBody] BiletiEvent biletiEvent) { return(_eventService.addEvent(biletiEvent)); }
public BiletiEvent getEventById(Guid id) { BiletiEvent biletiEvent = DbContext.BiletiEvents.Where(x => x.Id == id).FirstOrDefault(); return(biletiEvent); }