Exemplo n.º 1
0
        public async Task <IActionResult> PutOrderRow(Guid id, V1DTO.OrderRow orderRow)
        {
            if (id != orderRow.Id)
            {
                return(BadRequest(new V1DTO.MessageDTO("Id and OrderRow.Id do not match")));
            }

            await _bll.OrderRows.UpdateAsync(_mapper.Map(orderRow));

            await _bll.SaveChangesAsync();

            return(NoContent());
        }
Exemplo n.º 2
0
        public async Task <ActionResult <V1DTO.OrderRow> > PostOrderRow(V1DTO.OrderRow orderRow)
        {
            var bllEntity = _mapper.Map(orderRow);

            _bll.OrderRows.Add(bllEntity);
            await _bll.SaveChangesAsync();

            orderRow.Id = bllEntity.Id;

            return(CreatedAtAction("GetOrderRow",
                                   new { id = orderRow.Id, version = HttpContext.GetRequestedApiVersion()?.ToString() ?? "0" },
                                   orderRow));
        }