public static InventoryReceivingNoteDetailForFood Post( InventoryReceivingNoteDetailForFood inventoryReceivingNoteDetailForFood, string token ) { using (var client = HelperClient.GetClient(token)) { client.BaseAddress = new Uri(Common.Constants.BASE_URI); var postTask = client .PostAsJsonAsync <InventoryReceivingNoteDetailForFood>(Constants.INVENTORY_RECEIVE_NOTE_FOOD, inventoryReceivingNoteDetailForFood); postTask.Wait(); var result = postTask.Result; if (result.IsSuccessStatusCode) { var readTask = result.Content.ReadAsAsync <InventoryReceivingNoteDetailForFood>(); readTask.Wait(); return(readTask.Result); } return(null); } }
public async Task <ActionResult <InventoryReceivingNoteDetailForFood> > PostInventoryReceivingNoteDetailForFood(InventoryReceivingNoteDetailForFood inventoryReceivingNoteDetailForFood) { _context.InventoryReceivingNoteDetailForFood.Add(inventoryReceivingNoteDetailForFood); await _context.SaveChangesAsync(); return(CreatedAtAction("GetInventoryReceivingNoteDetailForFood", new { id = inventoryReceivingNoteDetailForFood.InventoryReceivingId }, inventoryReceivingNoteDetailForFood)); }
public async Task <IActionResult> PutInventoryReceivingNoteDetailForFood(int id, InventoryReceivingNoteDetailForFood inventoryReceivingNoteDetailForFood) { if (id != inventoryReceivingNoteDetailForFood.InventoryReceivingId) { return(BadRequest()); } _context.Entry(inventoryReceivingNoteDetailForFood).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InventoryReceivingNoteDetailForFoodExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }