Esempio n. 1
0
 public ActionResult Edit(Title title)
 {
     if (ModelState.IsValid)
     {
         db.Entry(title).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(title));
 }
        public IHttpActionResult GetTitle(int id)
        {
            Title title = db.Titles.Find(id);

            if (title == null)
            {
                return(NotFound());
            }
            db.Entry(title).Collection(x => x.Awards).Load();
            db.Entry(title).Collection(x => x.OtherNames).Load();
            db.Entry(title).Collection(x => x.StoryLines).Load();
            db.Entry(title).Collection(x => x.TitleGenres).Query().Include(x => x.Genre).Load();
            db.Entry(title).Collection(x => x.TitleParticipants).Query().Include(x => x.Participant).Load();
            return(Ok(title));
        }