public CreditCardAccountModel CreateEditCreditCard(CreditCardAccountModel model) { CreditCardEntity entity; //is update if (model.Id != default(long)) { entity = CreditCardAccountRepository.GetById(model.Id); entity = Mapper.Map(model, entity); } else { entity = Mapper.Map <CreditCardEntity>(model); entity = CreditCardAccountRepository.Insert(entity); } CreditCardAccountRepository.Save(); return(Mapper.Map <CreditCardAccountModel>(entity)); }
public IActionResult CreateEditCreditCard([FromBody] CreditCardAccountModel model) { return(Json(AccountService.CreateEditCreditCard(model))); }