コード例 #1
0
 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");
 }
コード例 #2
0
        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));
            }
        }
コード例 #3
0
 public Contacts ById(string id)
 {
     return(_filter.Filter(new[] { _datastore.ById(id) }).SingleOrDefault());
 }