Beispiel #1
0
        public WebApiReadDto AddData(WebApiCreateDto commandCreateDto)
        {
            var command = _mapper.Map <WebApiModel>(commandCreateDto);

            _repository.CreateCommand(command);
            _repository.SaveChanges();
            var response = _mapper.Map <WebApiReadDto>(command);

            return(response);
        }
Beispiel #2
0
        //public Task<ActionResult<WebApiReadDto>> CreateCommand(WebApiCreateDto webApiCreateDto)
        //{
        //    var commandModel = _mapper.Map<WebApiModel>(webApiCreateDto);
        //    _repository.CreateCommand(commandModel);
        //    _repository.SaveChanges();

        //    var commandReadDto = _mapper.Map<WebApiReadDto>(commandModel);
        //    return CreatedAtRoute(nameof(GetCommandById), new { ID = commandReadDto.Id }, commandReadDto);
        //}
        public ActionResult <WebApiReadDto> CreateCommand(WebApiCreateDto commandCreateDto)
        {
            var commandModel = _mapper.Map <WebApiModel>(commandCreateDto);

            _repository.CreateCommand(commandModel);
            _repository.SaveChanges();



            var commandReadDto = _mapper.Map <WebApiReadDto>(commandModel);



            return(CreatedAtRoute(nameof(GetCommandById), new { ID = commandReadDto.id }, commandReadDto));
            //return Ok(commandReadDto);
        }
Beispiel #3
0
        public ActionResult <WebApiReadDto> CreateCommandAsync(WebApiCreateDto commandCreateDto)
        {
            var response = _domain.AddData(commandCreateDto);

            return(response);
        }