public static async Task <Location> GetLocation(int locationId) { using (AwesomeContext context = new AwesomeContext()) { return(await context.Locations.FirstAsync(a => a.Id == locationId)); } }
public async Task TestReadAndWrite() { var factory = AwesomeEntityFramework.DefaultFactory <TestDbContext>( new DbContextOptionsBuilder <TestDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .ConfigureWarnings(x => x.Ignore(InMemoryEventId.TransactionIgnoredWarning)) .Options, options => new TestDbContext(options)); var logger = new LoggerFactory().CreateLogger <AwesomeContext <TestDbContext> >(); var context = new AwesomeContext <TestDbContext>(logger, factory); var id = Guid.NewGuid(); var added = await context.Write(async db => { var result = await db.AddAsync(new AwesomeModel { Id = id, Name = "Bob" }); return(result.Entity); }); Assert.Equal("Bob", added.Name); var read = await context.Read(async db => await db.FindAsync <AwesomeModel>(id)); Assert.Equal("Bob", read.Name); }
public static async Task CreateLocation(Location location) { using (AwesomeContext context = new AwesomeContext()) { context.Locations.Add(location); await context.SaveChangesAsync(); } }
public static async Task CreateParticipant(Participant participant) { using (AwesomeContext context = new AwesomeContext()) { context.Participants.Add(participant); await context.SaveChangesAsync(); } }
public static async Task CreateMeeting(Meeting meeting) { using (AwesomeContext awesomeContext = new AwesomeContext()) { awesomeContext.Meetings.Add(meeting); await awesomeContext.SaveChangesAsync(); } }
/// <summary> /// Update by overwriting everything /// </summary> /// <param name="newLocation"></param> /// <returns></returns> public static async Task UpdateLocation(Location newLocation) { using (AwesomeContext context = new AwesomeContext()) { context.Locations.Attach(newLocation); context.Entry(newLocation).State = EntityState.Modified; await context.SaveChangesAsync(); } }
/// <summary> /// Update by overwriting everything /// </summary> /// <param name="meeting"></param> /// <returns></returns> public static async Task UpdateMeeting(Meeting meeting) { using (AwesomeContext context = new AwesomeContext()) { context.Meetings.Attach(meeting); context.Entry(meeting).State = EntityState.Modified; await context.SaveChangesAsync(); } }
/// <summary> /// Update by overwriting everything /// </summary> /// <param name="newParticipant"></param> /// <returns></returns> public static async Task UpdateParticipant(Participant newParticipant) { using (AwesomeContext context = new AwesomeContext()) { context.Participants.Attach(newParticipant); context.Entry(newParticipant).State = EntityState.Modified; await context.SaveChangesAsync(); } }
public static async Task AddParticipantToMeeting(Participant participant, Meeting meeting) { using (AwesomeContext context = new AwesomeContext()) { context.Meetings.Attach(meeting); context.Participants.Attach(participant); meeting.Participants.Add(participant); await context.SaveChangesAsync(); } }
public static async Task <Participant> GetParticipant(int participantId, params Expression <Func <Participant, object> >[] includes) { using (AwesomeContext context = new AwesomeContext()) { Participant result = await context.Participants .IncludeRange(includes) .FirstAsync(a => a.Id == participantId); return(result); } }
public static async Task <List <Meeting> > GetMeetingsForParticipant(int participantId) { using (AwesomeContext context = new AwesomeContext()) { List <Meeting> result = await context.Participants .Where(a => a.Id == participantId) .SelectMany(a => a.EnrolledMeetings) .ToListAsync(); return(result); } }
public static async Task <Meeting> GetMeeting(int id, params Expression <Func <Meeting, object> >[] includes) { Meeting result; using (AwesomeContext context = new AwesomeContext()) { result = await context.Meetings .IncludeRange(includes) .FirstOrDefaultAsync(a => a.Id == id); } return(result); }
public static async Task <List <Meeting> > GetAllMeetings(params Expression <Func <Meeting, object> >[] includes) { List <Meeting> result; using (AwesomeContext context = new AwesomeContext()) { result = await context.Meetings .IncludeRange(includes) .ToListAsync(); } return(result); }
public static async Task <List <Meeting> > GetFutureMeetings() { using (AwesomeContext context = new AwesomeContext()) { List <Meeting> futureMeetings = await context.Meetings .Include(a => a.Participants) .Include(a => a.Location) .Where(a => a.MeetingStart > DateTime.Now) .ToListAsync(); return(futureMeetings); } }
public AddProjectForm(Models.Project project, AwesomeContext db) { InitializeComponent(); // TODO: Complete member initialization this.project = project; this.db = db; this.projectBindingSource.Add(project); var clientList = db.Clients.OrderBy(x => x.Name); comboBox1.Items.AddRange(clientList.Select(x => x.Name).ToArray()); comboBox1.SelectedIndex = comboBox1.FindStringExact(project.Client.Name); }
public ChannelsController(AwesomeContext context) { _context = context; }
public UserStatusesController(AwesomeContext context) { _context = context; }
public MessageTypesController(AwesomeContext context) { _context = context; }
public ACLPermissionsController(AwesomeContext context) { _context = context; }
public ACLRolesController(AwesomeContext context) { _context = context; }
public IdentityUsersController(AwesomeContext context) { _context = context; }