public async Task <IActionResult> Create([Bind("Id,TypeName")] CardTypeViewModel cardTypeViewModel)
        {
            if (ModelState.IsValid)
            {
                var cardTypeDTO = _mapper.Map <CardTypeDTO>(cardTypeViewModel);
                await _genericService.AddData(cardTypeDTO);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(cardTypeViewModel));
        }
示例#2
0
        public async Task <IActionResult> Create([Bind("Id,Name,CardTypeId,CardSeriesId,SeriesNum,CardPassword,ImagePath")] CardInfoViewModel cardInfoViewModel)
        {
            if (ModelState.IsValid)
            {
                var cardInfoDTO = _mapper.Map <CardInfoDTO>(cardInfoViewModel);
                await _cardInfoService.AddData(cardInfoDTO);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(cardInfoViewModel));
        }