Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Entity Framework 101
Message
From
04/06/2014 15:34:39
 
 
To
04/06/2014 15:31:43
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
General information
Forum:
ASP.NET
Category:
Entity Framework
Environment versions
Environment:
C# 4.0
OS:
Windows 8
Network:
Windows 2000 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01601183
Message ID:
01601296
Views:
28
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform