Exemplo n.º 1
0
        public static async Task AddAssociateToPerson(this AppDbContext db, Person associate, int personId)
        {
            if (await associate.ValidateAssociation(db, personId))
            {
                var personAssociate = new PersonAssociate
                {
                    PersonId    = personId,
                    AssociateId = associate.Id
                };

                await db.Associates.AddAsync(personAssociate);

                await db.SaveChangesAsync();
            }
        }
Exemplo n.º 2
0
 public static async Task RemovePersonAssociate(this AppDbContext db, PersonAssociate personAssociate)
 {
     db.Associates.Remove(personAssociate);
     await db.SaveChangesAsync();
 }
Exemplo n.º 3
0
 public async Task RemovePersonAssociate([FromBody] PersonAssociate personAssociate) => await db.RemovePersonAssociate(personAssociate);