public ActionResult <CommandeReadDto> CreateCommande(CommandeCreateDto commande)
        {
            var commandeModel = _mapper.Map <Commande>(commande);

            _repository.CreateCommande(commandeModel);
            _repository.SaveChanges();

            var CommandeReadDto = _mapper.Map <CommandeReadDto>(commandeModel);

            return(CreatedAtRoute(nameof(GetCommandeById), new { Id = CommandeReadDto.Id }, CommandeReadDto));
            //return Ok(CommandeReadDto);
        }
Beispiel #2
0
        public ActionResult <CommandReadDto> CreateCommand(CommandCreateDto commandCreateDto)
        {
            var commonModel = _mapper.Map <Command>(commandCreateDto);

            _repositoryCommander.CreateCommande(commonModel);
            _repositoryCommander.SaveChanges();

            var commandReadDto = _mapper.Map <CommandReadDto>(commonModel);

            return(CreatedAtRoute(nameof(GetCommandById), new { Id = commandReadDto.Id }, commandReadDto));
            // return Ok(commonModel);
        }