public async Task <ActionResult <Command> > PostCommand([FromBody] Command item)
        {
            _context.Commands.Add(item);
            await _context.SaveChangesAsync();

            OnCommandAdded?.Invoke(item);

            return(CreatedAtAction(nameof(GetCommand), new { item.id }, item));
        }
Beispiel #2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if ((txtTitle.Text != string.Empty) && (txtCommand.Text != string.Empty))
            {
                var apkCommand = new ApkCommand
                {
                    Title   = txtTitle.Text,
                    Command = txtCommand.Text
                };

                OnCommandAdded?.Invoke(this, apkCommand);

                Close();
            }
            else
            {
                MessageBox.Show("Please fill in all fields.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }