Ejemplo n.º 1
0
 public ActorDTO(Actor source)
 {
     ID = source.ID;
     Name = source.Name;
     DateOfBirth = source.DateOfBirth;
     StarredIn = source.StarredIn.Select(x => x.ID).ToArray();
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Adds a new actor to the database.
        /// </summary>
        /// <param name="value"></param>
        public void Post([FromBody]ActorDTO value)
        {
            Actor dbActor = new Actor();
            dbActor.Name = value.Name;
            dbActor.DateOfBirth = value.DateOfBirth;
            dbActor.StarredIn = _db.Movies.Where(x => value.StarredIn.Contains(x.ID)).ToList();

            _db.Actors.Add(dbActor);
            _db.SaveChanges();
        }
Ejemplo n.º 3
0
 private ActorDTO ConvertToDTO(Actor actor)
 {
     return new ActorDTO(actor);
 }