Пример #1
0
        public async Task <StringKeyValuePair> ValidateFound(string resourceId, string propertyName)
        {
            var notFoundId = await LookupRepository.Exists(resourceId);

            return(!notFoundId?
                   GetNotFound(propertyName, resourceId) :
                       null);
        }
Пример #2
0
        public async Task <ActionResult> Reassign(ReassginResource reassginResource)
        {
            var entity = await LookupRepository.FindFirst(e => e.Id == reassginResource.ResourceId);

            if (entity == null)
            {
                return(NotFound(reassginResource.ResourceId));
            }
            var isExists = await UserRepository.Exists(reassginResource.NewOwnerUserId);

            if (!isExists)
            {
                return(NotFound(reassginResource.NewOwnerUserId));
            }

            entity.UserId = reassginResource.NewOwnerUserId;
            await AlterRepository.Update(entity);

            return(Ok());
        }