/// <summary>
 /// Initializes a new instance of the <see cref="RetrieveMerchantResponse"/> class.
 /// </summary>
 /// <param name="errors">errors.</param>
 /// <param name="merchant">merchant.</param>
 public RetrieveMerchantResponse(
     IList <Models.Error> errors = null,
     Models.Merchant merchant    = null)
 {
     this.Errors   = errors;
     this.Merchant = merchant;
 }
Ejemplo n.º 2
0
        public async Task <IActionResult> Post([FromBody] Models.Merchant category)
        {
            category.State  = ReviewState.UnReviewed;
            category.Remark = null;
            await _repository.InsertAsync(category);

            return(Ok(ResultModel.Success(category)));
        }
Ejemplo n.º 3
0
        public MerchantViewModel(Models.Merchant merchant)
        {
            this.merchant = merchant;

            //
            name     = merchant.Name;
            contact  = merchant.Contact;
            networks = merchant.SupportedNetworks;
            location = merchant.Location;
        }
        public ActionResult Add(Models.Merchant newMerchant)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            Guid newId = Guid.NewGuid();

            _commandSender.Send <CreateMerchant>(new CreateMerchant(newId, newMerchant.Name, newMerchant.Email, newMerchant.Commission));

            return(RedirectToAction("Details", new { id = newId }));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Put(int id, [FromBody] Models.Merchant model)
        {
            if (id <= 0)
            {
                return(BadRequest(ResultModel.Fail <Models.Merchant>("请求参数异常")));
            }
            var before = await _repository.FindAsync(id);

            if (null == before)
            {
                return(BadRequest(ResultModel.Fail <Models.Merchant>($"分类不存在,id:{id}")));
            }

            model.Id = id;
            await _repository.UpdateWithoutAsync(model, m => m.State, m => m.Remark);

            return(Ok(ResultModel.Success(model)));
        }
 public Builder Merchant(Models.Merchant merchant)
 {
     this.merchant = merchant;
     return(this);
 }
 public Builder Merchant(Models.Merchant value)
 {
     merchant = value;
     return(this);
 }