Esempio n. 1
0
        public async Task <BaseResponse> GiftCodeCampaignChangeStatus(GiftCodeCampaignChangeStatusRequest request)
        {
            BaseResponse response = new BaseResponse();

            try
            {
                var currentUser = await _currentContext.GetCurrentCustomer();

                var command = request.ToCommand(currentUser.Id, request.Version, request.ShardId);
                var result  = await _giftcodeService.SendCommand(command);

                if (result.IsSucess)
                {
                    response.SetSucess();
                }
                else
                {
                    response.SetFail(result.Message);
                }
            }
            catch (Exception e)
            {
                response.SetFail(e);
                _logger.LogError(e, e.Message, request);
            }
            return(response);
        }
 public static GiftCodeCampaignChangeStatusCommand ToCommand(this GiftCodeCampaignChangeStatusRequest request, string currentUid, int version, int shardId)
 {
     if (request == null)
     {
         return(null);
     }
     return(new GiftCodeCampaignChangeStatusCommand()
     {
     });
 }
Esempio n. 3
0
 public async Task <IActionResult> CampaignChangeStatus([FromBody] GiftCodeCampaignChangeStatusRequest request)
 {
     try
     {
         BaseResponse response = new BaseResponse();
         var          results  = GiftCodeCampaignChangeStatusRequestValidator.ValidateModel(request);
         if (results.IsValid)
         {
             response = await _giftcodeAppService.GiftCodeCampaignChangeStatus(request);
         }
         else
         {
             response.SetFail(results.Errors.Select(p => p.ToString()));
         }
         return(Json(response));
     }
     catch (Exception e)
     {
         _logger.LogError(e, Common.Common.GetMethodName());
         throw;
     }
 }