private static void AddFilmPerson(FilmContext context, int filmId, int personId, string role) { FilmPerson fp = new FilmPerson(filmId, personId, role); context.FilmPeople.Add(fp); Save(context); }
internal void AddContributor(Role role) { StringDialog dialog = new StringDialog("A partial last name"); dialog.ShowDialog(); if (dialog.Accept) { string lastName = dialog.YourString; if (lastName == "") { ReportIt("You must enter a nonempty last name"); return; } Person p = GetPersonFor(lastName); if (p == null) { return; } FilmPerson fp = new FilmPerson(); fp.FilmId = CurrentFilm.Id; fp.PersonId = p.Id; fp.Roles.Add(role); _filmPersonRepository.Add(fp); } }
private void AddAFilmPerson(FilmContext context, int filmId, int personId, string role) { var fp = new FilmPerson(filmId, personId, role); context.FilmPeople.Add(fp); context.SaveChanges(); }
private int AddFilmPerson(FilmContext context, int filmId, int personId, string role) { var fp = new FilmPerson(filmId, personId, role); context.FilmPeople.Add(fp); context.SaveChanges(); return(fp.Id); }
public override FilmPerson Add(FilmPerson entity) { if (entity.Id.Equals(Guid.Empty)) { _context.FilmPeople().Add(entity); } return((entity == null) ? null : (FilmPerson)entity.Clone()); }
internal void AddContributor(Role role) { string lastName = GetAString("A partial last name"); Person p = GetPersonByLastName(lastName); FilmPersonRepository filmPersonRepo = _factory.CreateFilmPersonRepository(); FilmPerson fp = new FilmPerson(); fp.FilmId = CurrentFilm.Id; fp.PersonId = p.Id; fp.Roles.Add(role); filmPersonRepo.Add(fp); }
public override FilmPerson Add(FilmPerson entity) { if (entity == null) { throw new Exception("Null Argument"); } if (entity.Id.Equals(Guid.Empty)) { entity.Id = Guid.NewGuid(); _entities.Add(entity); } return((FilmPerson)entity.Clone()); }
public override void Update(FilmPerson entity) { _context.StateChanged(entity); _context.Save(); }
public override FilmPerson GetById(Guid id) { FilmPerson entity = _context.FilmPeople().Single(fp => fp.Id.Equals(id)); return((entity == null) ? null : (FilmPerson)entity.Clone()); }
public override void Delete(FilmPerson entity) { _context.FilmPeople().Remove(entity); }
public override void Update(FilmPerson entity) { FilmPerson storedEntity = _entities.Single(fp => fp.Id.Equals(entity.Id)); storedEntity.Copy(entity); }
public override void Delete(FilmPerson entity) { _entities.Remove(entity); }