public void OwnerMustBeSameOrganisation() { RuleFor(x => x) .Must(x => { var orgId = _context.OrganisationId(); var claimContact = _contactsDatastore.ById(x.OwnerId); return(claimContact?.OrganisationId == orgId); }) .WithMessage("Contact must be from organisation"); }
public virtual IActionResult ApiContactsByIdByIdGet([FromRoute][Required] string id) { try { var contact = _datastore.ById(id); if (contact == null) { return(StatusCode(404)); } return(new ObjectResult(contact)); } catch (Crm.CrmApiException ex) { return(StatusCode((int)ex.HttpStatus, ex.Message)); } }
public Contacts ById(string id) { return(_filter.Filter(new[] { _datastore.ById(id) }).SingleOrDefault()); }