Beispiel #1
0
 public void DeleteCommand(Command cmd)
 {
     if (cmd == null)
     {
         throw new ArgumentNullException(nameof(cmd));
     }
     _context.Commands.Remove(cmd);
     _context.SaveChanges();
 }
Beispiel #2
0
        public static void SeedData(CommanderContext context)
        {
            if (!context.Commands.Any())
            {
                System.Console.WriteLine("Adding data - seeding...");

                context.Commands.AddRange(
                    new Command {
                    HowTo = "How to create a migration", Line = "dotnet ef migrations add <Name of migration>", Platform = "EF Core"
                },
                    new Command {
                    HowTo = "How to apply migrations", Line = "dotnet ef database update", Platform = "EF Core"
                },
                    new Command {
                    HowTo = "Run a .NET Core app", Line = "dotnet run", Platform = ".NET Core CLI"
                },
                    new Command {
                    HowTo = "Rollback a migration", Line = "dotnet ef migration remove", Platform = "EF Core"
                },
                    new Command {
                    HowTo = "Install a new package", Line = "dotnet add package <Name of the package>", Platform = ".NET Core CLI"
                },
                    new Command {
                    HowTo = "Run a .NET Core app", Line = "dotnet run", Platform = ".NET Core CLI"
                }
                    );
                context.SaveChanges();
            }
            else
            {
                System.Console.WriteLine("Already have data - not seeding");
            }
        }
 public void CreateCommand(Command command)
 {
     if (command == null)
     {
         throw new ArgumentNullException(nameof(command));
     }
     _context.Commands.Add(command);
     _context.SaveChanges();
 }
Beispiel #4
0
 bool ICommanderRepo.SaveChanges()
 {
     return(_context.SaveChanges() >= 0); //This method change the data effectively in your DB
 }
 public bool SaveChanges()
 {
     return(_context.SaveChanges() >= 0);    //???
 }
 protected bool SaveChanges()
 {
     return(_context.SaveChanges() >= 0);
 }
Beispiel #7
0
 public bool SaveChanges()
 {
     // permet d'appliquer les modifications à la db
     return(_context.SaveChanges() >= 0);
 }
Beispiel #8
0
 public bool SaveChanges()
 {
     return(_context.SaveChanges() > 0);
 }
Beispiel #9
0
 public bool SaveChanges() => _context.SaveChanges() >= 0;
Beispiel #10
0
 public bool saveChganges()
 {
     return(_commanderContext.SaveChanges() > 1);
 }
 public bool SaveChange()
 {
     //Actual SAVE in SQL DB
     return(_context.SaveChanges() >= 0);
 }
 public bool SaveChanges()
 {
     return(_context.SaveChanges() >= 0);   // if you are making changes to data via datacontext, will need to call this method in order to save changes on the DB
 }
Beispiel #13
0
 public bool SaveChanges()
 {
     // throw new System.NotImplementedException();
     return(_context.SaveChanges() >= 0);
 }
 public bool SaveChanges() // create command
 {
     return(_context.SaveChanges() >= 0);
 }
Beispiel #15
0
 public bool SaveChanges()
 {
     return(_dbContext.SaveChanges() >= 0);
 }
 bool ICommanderRepo.SaveChanges()
 {
     //Commits changes done by entity framework onto the database provider
     return(_context.SaveChanges() >= 0);
 }
Beispiel #17
0
 public bool SaveChanges()
 {
     // Data in database won't be changed, without calling this method.
     return(_context.SaveChanges() >= 0);
 }
Beispiel #18
0
 public bool SaveChanges()
 {
     return(_ctx.SaveChanges() >= 0);
 }
 // ------------------------------------------------>
 public bool SaveChanges()
 {
     // When a change occur, the database won't change unless this method is called
     return(_context.SaveChanges() >= 0);
 }
 public bool SaveChanges()
 {
     return(_commanderContext.SaveChanges() >= 0);
 }
 public bool SaveChanges()
 {
     // Save changes in the database by calling
     // this method
     return(_context.SaveChanges() >= 0);
 }
Beispiel #22
0
 public bool SaveChanges()
 {
     return((_context.SaveChanges()) >= 0);
 }
 public bool dbSaveChanges()
 {
     _context.SaveChanges();
     return(true);
 }