public async Task <OrderDTO> Update(OrderDTO data) { var order = await orders.GetAll().FirstOrDefaultAsync(x => x.OrderId == data.OrderId); if (order != null) { order.ProductCount = data.Count; order.ProductId = data.ProductId; order.ClientId = data.ClientId; order = await orders.Update(order); } return((await GetAsync(data.OrderId)).FirstOrDefault()); }
public virtual IActionResult Put([FromRoute] int id, [FromBody] TMap entity) { try { var item = mapper.Map <TEntity>(entity); service.Update(item, id); } catch (ArgumentException e) { return(BadRequest(e.Message)); } return(Ok()); }