Exemplo n.º 1
0
 public ActionResult <Group> Edit(int id, [FromBody] Group groupToUpdate)
 {
     try
     {
         groupToUpdate.Id = id;
         string userId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value;
         return(Ok(_gs.Edit(groupToUpdate, userId)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Exemplo n.º 2
0
 public ActionResult <Group> Edit(int id, [FromBody] Group editedGroup)
 {
     try
     {
         editedGroup.Id = id;
         string userId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value;
         editedGroup.UserId = userId;
         return(Ok(_gs.Edit(editedGroup)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Exemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [FromBody] GroupEditDto model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(this.GetErrors(model)));
            }

            OperationResult result = await _service.Edit(model);

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

            return(Ok(result));
        }