public IActionResult NewEntryPost(int id, NewEntryVM vm) { if (vm == null) { throw new Exception("Model cannot be empty"); } if (id == 0) { _businessLogic.CreateNewEntry(vm); } else { _businessLogic.UpdateEntry(id, vm); } return(Json(new { stockId = vm.StockItems.Id, materialId = vm.Materials.Id })); }