Esempio n. 1
0
        public async Task <ActionResult <BaseDto <Merchants_> > > Get(int id)
        {
            var command = new GetMerchantQuery(id);
            var result  = await _mediatr.Send(command);

            return(result != null ? (ActionResult)Ok(new { Message = "success", data = result }) : NotFound(new { Message = "not found" }));
        }
        public async Task <IActionResult> Get(int ID)
        {
            var result = new GetMerchantQuery(ID);
            var wait   = await meciater.Send(result);

            return(wait != null ? (IActionResult)Ok(wait) : NotFound());
        }
        public async Task <ActionResult <MerchantViewModel> > GetMerchant([FromRoute][Required] string uniqueId)
        {
            var request = new GetMerchantQuery
            {
                UniqueId = uniqueId
            };

            var response = await Mediator.Send(request);

            return(response.ToActionResult <MerchantViewModel>());
        }
        public void ShouldFail_When_InputUniqueIdInValid(string uniqueId)
        {
            var query = new GetMerchantQuery
            {
                UniqueId = uniqueId
            };

            var validationResult = _validator.TestValidate(query);

            validationResult.ShouldHaveValidationErrorFor(nameof(GetMerchantQuery.UniqueId));
        }
        public void ShouldPass_When_InputFormatValid(string uniqueId)
        {
            var query = new GetMerchantQuery
            {
                UniqueId = uniqueId
            };

            var validationResult = _validator.TestValidate(query);

            validationResult.ShouldNotHaveAnyValidationErrors();
        }
Esempio n. 6
0
        public async Task <IActionResult> GetAsync(int id)
        {
            var result = new GetMerchantQuery(id);

            return(result != null ? (IActionResult)Ok(await _mediatr.Send(result)) : NotFound(new { Message = "Merchant not found" }));
        }
        public async Task <ActionResult <GetMerchantDto> > GetmerchantById(int id)
        {
            var result = new GetMerchantQuery(id);

            return(Ok(await _mediatr.Send(result)));
        }
Esempio n. 8
0
        public async Task<ActionResult> GetById(int id)
        {
            var merchant = new GetMerchantQuery(id);

            return Ok(await _mediatr.Send(merchant));
        }