public static Event EditEvent(Event eventModel) { using (var con = Open()) { eventModel.EditDate = DateTime.Now; CommandDefinition command = new CommandDefinition(StoredProcedures.Proc_Custom_EventRepositories_EditEvent.ToString(), new { eventModel.EventId, eventModel.EventDate, eventModel.EventLocation, eventModel.GuestsAttending, eventModel.Title, eventModel.EventDescription, eventModel.CreateDate, }, commandType: CommandType.StoredProcedure); eventModel = con.Query<Event>(command).FirstOrDefault(); } if (eventModel == null) { eventModel = new Event(); } return eventModel; }
public static void DeleteEvent(int id) { Event rsvp = new Event(); using (var con = Open()) { CommandDefinition command = new CommandDefinition(StoredProcedures.Proc_Custom_EventRepositories_DeleteEvent.ToString(), new { id = id }, commandType: CommandType.StoredProcedure); rsvp = con.Query<Event>(command).FirstOrDefault(); } }
public static Event GetEventById(int id) { Event eventModel = new Event(); using (var con = Open()) { CommandDefinition command = new CommandDefinition(StoredProcedures.Proc_Custom_EventRepositories_GetEventById.ToString(), new { id = id }, commandType: CommandType.StoredProcedure); eventModel = con.Query<Event>(command).FirstOrDefault(); } return eventModel; }