public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } People = await _context.People .Include(p => p.LastEditedByNavigation).FirstOrDefaultAsync(m => m.PersonId == id); if (People == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } People = await _context.People.FindAsync(id); if (People != null) { _context.People.Remove(People); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } People = await _context.People .Include(p => p.LastEditedByNavigation).FirstOrDefaultAsync(m => m.PersonId == id); if (People == null) { return(NotFound()); } ViewData["LastEditedBy"] = new SelectList(_context.People, "PersonId", "FullName"); return(Page()); }
private Models.People AddPeople(Movie currMovie, MovieEntities context, Models.People people, Kind kind) { ViewModels.People currPeople = GetCurrPeople(currMovie, kind); var currStudio = context.Studio.FirstOrDefault(x => x.name == currPeople.Studio.Name); if (currStudio == null) { currStudio = AddStudio(currPeople.Studio, context); } people = new Models.People() { firstName = currMovie.Director.FirstName, lastName = currMovie.Director.LastName, age = currMovie.Director.Age, studioId = currStudio.id, kindId = (int)kind }; context.People.Add(people); context.SaveChanges(); return people; }