コード例 #1
0
        public async Task <DealerDTO> PutAsync(DealerCreateDTO dealer)
        {
            this.Logger.LogTrace($"{nameof(this.PutAsync)} called");
            var result = await this.DealerService.CreateAsync(this.Mapper.Map <DealerUpdateModel>(dealer));

            return(this.Mapper.Map <DealerDTO>(result));
        }
コード例 #2
0
        public int CreateDealer(DealerCreateDTO createDto)
        {
            var dealer = _mapper.Map <Dealer>(createDto);


            ///////////////////////////////something wrong  not assign

            dealer.CreatedById = _userContextService.GetUserId;
            _dealerDbContext.Add(dealer);
            _dealerDbContext.SaveChanges();

            return(dealer.Id);
        }
コード例 #3
0
        //[Authorize(Roles = "Dealer Manager")] // calim role must have in JWT
        // test for user
        public ActionResult CreateDealer(DealerCreateDTO createDto)
        {
            //use []  from client and iterate by them ..... :)
            // hot to itterate for DTO  form body
            //var userId =   int.Parse(User.FindFirst(u => u.Type == ClaimTypes.NameIdentifier).Value);
            //foreach (var item in createDto)
            //{

            //}


            var id = _dealerService.CreateDealer(createDto);



            return(Created($"api/Dealer/{id}", null));
        }