} // Insert

/*
 *      public SetByGuidResponse SetByGuid(SetByGuidRequest request)
 *      {
 *
 *          SetByGuidResponse response = new SetByGuidResponse();
 *
 *          try
 *          {
 *
 *            IsExistByGuidResponse isExistByGuidResponse =
 *                IsExistByGuid(new IsExistByGuidRequest() { Guid = request.Guid } );
 *
 *            if (isExistByGuidResponse.Result.Success())
 *            {
 *
 *                UpdateByGuidResponse updateByGuidResponse =
 *                    UpdateByGuid(
 *                        new UpdateByGuidRequest()
 *                        {
 *                            Guid = request.Guid
 *                            ,
 *                            AuthenticationRequest = request.AuthenticationRequest
 *                        });
 *
 *                response.Result = updateByGuidResponse.Result;
 *
 *            }
 *            else
 *            {
 *
 *                InsertResponse insertResponse =
 *                    Insert(
 *                        new InsertRequest()
 *                        {
 *                            AuthenticationRequest = request.AuthenticationRequest
 *                        });
 *
 *                response.Result = insertResponse.Result;
 *
 *            }
 *
 *          }
 *          catch (Exception exception)
 *          {
 *              response.Result = (new Ac4yProcessResult() { Code = Ac4yProcessResult.FAIL, Message = exception.Message, Description = exception.StackTrace });
 *          }
 *
 *          return response;
 *
 *      } // SetByGuid
 */
        public DeleteByIdResponse DeleteById(DeleteByIdRequest request)
        {
            DeleteByIdResponse response = new DeleteByIdResponse();

            try
            {
                if (new AuthenticationRequestCap().IsExistById(request.Id))
                {
                    new AuthenticationRequestCap().DeleteById(request.Id);

                    response.Result = new Ac4yProcessResult()
                    {
                        Code = Ac4yProcessResult.SUCCESS
                    };
                }
                else
                {
                    response.Result = new Ac4yProcessResult()
                    {
                        Code = Ac4yProcessResult.FAIL, Message = "Adott id-val nem létezik rekord."
                    };
                }
            }
            catch (Exception exception)
            {
                response.Result = (new Ac4yProcessResult()
                {
                    Code = Ac4yProcessResult.FAIL, Message = exception.Message, Description = exception.StackTrace
                });
            }

            return(response);
        } // DeleteById
コード例 #2
0
        public async Task Handle_DefaultDeleteByIdWithResponse_DeletesUserAndReturnsDto()
        {
            var request = new DeleteByIdRequest <User, UserGetDto>(_user.Id);

            var response = await Mediator.HandleAsync(request);

            Assert.IsFalse(response.HasErrors);
            Assert.IsNotNull(response.Result);
            Assert.AreEqual(_user.Id, response.Result.Id);
            Assert.IsTrue(response.Result.IsDeleted);
        }
コード例 #3
0
        public async Task Handle_DefaultDeleteByIdWithoutResponse_DeletesUser()
        {
            var request = new DeleteByIdRequest <User>(_user.Id);

            var response = await Mediator.HandleAsync(request);

            Assert.IsFalse(response.HasErrors);
            var user = Context.Set <User>().First();

            Assert.IsNotNull(user);
            Assert.AreEqual(_user.Id, user.Id);
            Assert.IsTrue(user.IsDeleted);
        }