Example #1
0
 public ActionResult AddItem(AddCartItemCommand input)
 {
     /*            if (!ModelState.IsValid)
      *  return IncodingResult.Error(ModelState);
      *
      * try
      * {
      *  this.dispatcher.Push(input);
      *  return IncodingResult.Success();
      * }
      * catch (IncWebException incWebException)
      * {
      *  ModelState.AddModelError(incWebException.Property, incWebException.Message);
      *  return IncodingResult.Error(ModelState);
      * }*/
     return(TryPush(input)); // above show how it work in depth
 }
        public async Task <IActionResult> Add(AddCartItemCommand command)
        {
            var cart = await _mediator.Send(command);

            return(Ok(cart));
        }
Example #3
0
 public async Task <ActionResult <List <Response> > > Post([FromBody] AddCartItemCommand cmd)
 {
     return(Ok(await _mediator.Send(cmd)));
 }