Ejemplo n.º 1
0
        public async Task <ActionResult> AddToCompany(int contactId, int companyId)
        {
            if (!await _contactService.CompanyExists(companyId) ||
                !await _contactService.ContactExists(contactId))
            {
                return(NotFound());
            }

            if (await _contactService.ContactCompanyRelationExists(contactId, companyId))
            {
                return(BadRequest());
            }

            if (!await _contactService.AddContactToCompany(contactId, companyId))
            {
                return(StatusCode(500, "A Problem happened while handling your request"));
            }

            return(Ok());
        }