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)); }
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); }
//[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)); }