public async Task <IActionResult> PutMovementDetail([FromRoute] int id, [FromBody] MovementDetail movementDetail)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != movementDetail.Id)
            {
                return(BadRequest());
            }

            _context.Entry(movementDetail).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MovementDetailExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
 public static RegisteredMovementDetail ToDTO(this MovementDetail movementDetail)
 {
     return(new RegisteredMovementDetail()
     {
         ProductId = movementDetail.ProductId
         ,
         Count = movementDetail.Count
         ,
         Id = movementDetail.Id
     });
 }
        public async Task <IActionResult> PostMovementDetail([FromBody] MovementDetail movementDetail)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.MovementDetails.Add(movementDetail);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetMovementDetail", new { id = movementDetail.Id }, movementDetail));
        }