Пример #1
0
        public async Task <ActionResult> Put(int id, [FromForm] CombustibleDTO combustibleDTO)
        {
            var updateCombustible = _mapper.Map <Combustible>(combustibleDTO);

            updateCombustible.Id = id;
            await _combustibleService.UpdateCombustible(updateCombustible);

            return(NoContent());
        }
Пример #2
0
        public async Task <ActionResult> Post([FromForm] CombustibleDTO combustibleDTO)
        {
            var combustible = _mapper.Map <Combustible>(combustibleDTO);
            await _combustibleService.InsertCombustible(combustible);

            combustibleDTO = _mapper.Map <CombustibleDTO>(combustible);
            var response = new ApiResponse <CombustibleDTO>(combustibleDTO);

            return(Created(nameof(Get), new { id = combustible.Id, response }));
        }