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); } }
public async Task <ActionResult <InventoryReceivingNoteDetailForToy> > PostInventoryReceivingNoteDetailForToy(InventoryReceivingNoteDetailForToy inventoryReceivingNoteDetailForToy) { _context.InventoryReceivingNoteDetailForToy.Add(inventoryReceivingNoteDetailForToy); await _context.SaveChangesAsync(); return(CreatedAtAction("GetInventoryReceivingNoteDetailForToy", new { id = inventoryReceivingNoteDetailForToy.InventoryReceivingId }, inventoryReceivingNoteDetailForToy)); }
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()); }