public async Task <IActionResult> Index(int id)
        {
            CustomerCard customerCard = await _customerCardManager.FindById(id);

            Customer customer = await _customerManager.FindById(id);

            List <CustomerCardRow> customerCardRows = await _customerCardRowManager.GetAllASync(x => x.CustomerCardId == id);

            List <CustomerCardRowAddDto> customerCardRowAddDto = _mapper.Map <List <CustomerCardRowAddDto> >(customerCardRows);

            CustomerCardAddDto customerCardAddDto = _mapper.Map <CustomerCardAddDto>(customerCard);

            customerCardAddDto.CustomerCardRowAddDto = customerCardRowAddDto;
            customerCardAddDto.CreateDate            = customerCard.CreatedDate;
            return(View(customerCardAddDto));
        }
Exemple #2
0
        public async Task <IActionResult> Edit(int id)
        {
            CustomerCard customerCard = await _customerCardManager.FindById(id);

            List <CustomerCardRow> customerCardRows = await _customerCardRowManager.GetAllASync(x => x.CustomerCardId == id);


            List <CustomerCardRowAddDto> customerCardRowAddDto = _mapper.Map <List <CustomerCardRowAddDto> >(customerCardRows);

            CustomerCardAddDto customerCardAddDto = _mapper.Map <CustomerCardAddDto>(customerCard);
            List <User>        users = await _userManager.GetAllASync();

            var user = users.Find(x => x.Name == customerCard.ProductManagerName);

            customerCardAddDto.CustomerCardRowAddDto = customerCardRowAddDto;
            ViewBag.CustomerId              = new SelectList(await _customerManager.GetAllASync(x => x.CustomerId == customerCard.CustomerId), "CustomerId", "CustomerName");
            ViewBag.DeveloperName           = new SelectList(users, "UserId", "Name");
            ViewBag.ProductId               = new SelectList(users, "UserId", "Name", user.UserId);
            customerCardAddDto.FinishedDate = DateTime.Now;
            return(View(customerCardAddDto));
        }