private void brEnregistrer_Click(object sender, EventArgs e)
        {
            GroupsService groupService = new GroupsService();
            Group         g            = new Group();

            g.Id  = int.Parse(idTextBox.Text);
            g.Nom = nomTextBox.Text;
            groupService.Add(g);
        }
Esempio n. 2
0
        public async Task <IActionResult> Add([FromBody] GroupEditDto model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(this.GetErrors(model)));
            }

            OperationResult result = await _service.Add(model);

            if (result.HasError)
            {
                return(this.Unprocessable(result));
            }

            return(Ok(result));
        }