private async Task SeedDatabase(AppDbcontext context, UserManager <ApplicationUser> userManager) { if (!await context.Users.AnyAsync()) { var user = new ApplicationUser { UserName = "******", Email = "*****@*****.**" }; var result = await userManager.CreateAsync(user, "Guest1!"); if (!result.Succeeded) { throw new ApplicationException("Could not created default user"); } context.KnuxPhrases.Add(new KnuxPhrase { Owner = user, KnuxValue = "punk cats" }); context.KnuxPhrases.Add(new KnuxPhrase { KnuxValue = "funk bats" }); context.SaveChanges(); } }
public bool CreateContract(Contract contract) { var contractExist = context.contracts.Where(x => (x.contractSource == contract.contractSource && x.contractTraget == contract.contractTraget) || (x.contractSource == contract.contractSource && x.contractTraget == contract.contractTraget)).FirstOrDefault(); if (contractExist == null) { context.contracts.Add(contract); context.SaveChanges(); return(true); } return(false); }
public Advisor Add(Advisor advisor) { context.Advisors.Add(advisor); context.SaveChanges(); return(advisor); }
public bool Save() { return(_context.SaveChanges() >= 0); }
public Carrier Add(Carrier carrier) { context.Carriers.Add(carrier); context.SaveChanges(); return(carrier); }
public void Addsensor(Sensor sensor) { _context.Sensors.Add(sensor); _context.SaveChanges(); }
public MGA Add(MGA MGA) { context.MGAs.Add(MGA); context.SaveChanges(); return(MGA); }
public void Addcontro(ConVector conVector) { _context.ConVectors.Add(conVector); _context.SaveChanges(); }
public void Addcellect(Cellect cellect) { _context.Cellects.Add(cellect); _context.SaveChanges(); }