示例#1
0
        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();
            }
        }
示例#2
0
        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);
 }
示例#4
0
 public bool Save()
 {
     return(_context.SaveChanges() >= 0);
 }
 public Carrier Add(Carrier carrier)
 {
     context.Carriers.Add(carrier);
     context.SaveChanges();
     return(carrier);
 }
示例#6
0
 public void Addsensor(Sensor sensor)
 {
     _context.Sensors.Add(sensor);
     _context.SaveChanges();
 }
示例#7
0
 public MGA Add(MGA MGA)
 {
     context.MGAs.Add(MGA);
     context.SaveChanges();
     return(MGA);
 }
示例#8
0
 public void Addcontro(ConVector conVector)
 {
     _context.ConVectors.Add(conVector);
     _context.SaveChanges();
 }
示例#9
0
 public void Addcellect(Cellect cellect)
 {
     _context.Cellects.Add(cellect);
     _context.SaveChanges();
 }