Beispiel #1
0
        public static InventoryReceivingNoteDetailForToy Post(
            InventoryReceivingNoteDetailForToy inventoryReceivingNoteDetailForToy,
            string token
            )
        {
            using (var client = HelperClient.GetClient(token))
            {
                client.BaseAddress = new Uri(Common.Constants.BASE_URI);

                var postTask = client
                               .PostAsJsonAsync <InventoryReceivingNoteDetailForToy>(Constants.INVENTORY_RECEIVE_NOTE_FOOD, inventoryReceivingNoteDetailForToy);
                postTask.Wait();

                var result = postTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    var readTask = result.Content.ReadAsAsync <InventoryReceivingNoteDetailForToy>();
                    readTask.Wait();

                    return(readTask.Result);
                }
                return(null);
            }
        }
Beispiel #2
0
        public async Task <ActionResult <InventoryReceivingNoteDetailForToy> > PostInventoryReceivingNoteDetailForToy(InventoryReceivingNoteDetailForToy inventoryReceivingNoteDetailForToy)
        {
            _context.InventoryReceivingNoteDetailForToy.Add(inventoryReceivingNoteDetailForToy);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetInventoryReceivingNoteDetailForToy", new { id = inventoryReceivingNoteDetailForToy.InventoryReceivingId }, inventoryReceivingNoteDetailForToy));
        }
Beispiel #3
0
        public async Task <IActionResult> PutInventoryReceivingNoteDetailForToy(int id, InventoryReceivingNoteDetailForToy inventoryReceivingNoteDetailForToy)
        {
            if (id != inventoryReceivingNoteDetailForToy.InventoryReceivingId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }