Ejemplo n.º 1
0
        public Actor createOrUpdateActor(Actor actor)
        {
            if (actor.ID != null&& actor.ID!=new Guid("00000000-0000-0000-0000-000000000000"))
            {
                var person = model.Person.Find(actor.ID);
                person.EnglishName = actor.name;

                model.Entry(person).State = EntityState.Modified;
                model.SaveChanges();
            }
            else
            {
                var person = new Person
                {
                    EnglishName = actor.name,
                    RussianName = "",
                    PersonId = Guid.NewGuid()

                };
                model.Person.Add(person);
                model.SaveChanges();
                actor.ID = person.PersonId;
            }
            return actor;
        }
Ejemplo n.º 2
0
 public void deleteActor(Actor actor)
 {
     if(actor.ID != null )
     {
         var person = model.Person.Find(actor.ID);
         model.Person.Remove(person);
         model.SaveChanges();
     }
 }