Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Entity Framework 101
Message
De
04/06/2014 15:34:39
 
 
À
04/06/2014 15:31:43
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Entity Framework
Versions des environnements
Environment:
C# 4.0
OS:
Windows 8
Network:
Windows 2000 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01601183
Message ID:
01601296
Vues:
29
public ActionResult Refresh()
        {
            var movies = MovieLoader.LoadMovies();


            _dataContext.ProductionCompanyMovies.Delete();
            _dataContext.MovieGenres.Delete();
            _dataContext.Characters.Delete();
            _dataContext.Actors.Delete();
            _dataContext.Movies.Delete();
            _dataContext.Genres.Delete();
            _dataContext.ProductionCompanies.Delete();
            _dataContext.MovieStatuses.Delete();
            _dataContext.SaveChanges();
            movies.ForEach(movie => _dataContext.Movies.Add(movie));
            if (_dataContext.MovieStatuses.All(status => status.Status != "Cancelled"))
            {
                _dataContext.MovieStatuses.Add(new MovieStatus("Cancelled"));
            }
            if (_dataContext.MovieStatuses.All(status => status.Status != "Planned"))
            {
                _dataContext.MovieStatuses.Add(new MovieStatus("Planned"));
            }
            if (_dataContext.MovieStatuses.All(status => status.Status != "In Production"))
            {
                _dataContext.MovieStatuses.Add(new MovieStatus("In Production"));
            }
            _dataContext.SaveChanges();


            return new HttpStatusCodeResult(HttpStatusCode.OK);
        }
The strings in
new MoveStatus("magic string")

status.Status != "In Production"
>Where exactly is this magic string you speak of?
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform