public static void PopulateDb(TimeKeeperDbContext context) { ApplicationUser user1 = new ApplicationUser { Id = "70658403-ade4-47cf-82a6-034e176290f0", Email = "*****@*****.**", UserName = "******", }; ApplicationUser user2 = new ApplicationUser { Id = "2f044b20-3c7f-4be1-b1b5-c55fbfc0c679", Email = "*****@*****.**", UserName = "******", }; // OrganisationId will be 1. Organisation org = new Organisation { Name = "Electronics Store", ManagerId = "70658403-ade4-47cf-82a6-034e176290f0", OrganisationUsers = new List <ApplicationUser> { user2 }, }; context.Add(user1); context.Add(user2); context.Add(org); context.SaveChanges(); }
public async Task <Deviation> AddDeviationAsync(Deviation deviation) { using (var _context = new TimeKeeperDbContext(_options)) { var result = _context.Add(deviation); await _context.SaveChangesAsync(); return(result.Entity); } }
public async Task <WorkMonth> AddWorkMonth(WorkMonth workMonth) { using (var context = new TimeKeeperDbContext(_options)) { var result = context.Add(workMonth); await context.SaveChangesAsync(); return(result.Entity); } }