コード例 #1
0
        public async Task <ActionResult> Put(int id, [FromBody] Empleados model)
        {
            if (id != model.IdEmpleado)
            {
                return(BadRequest());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    await _empleados.Edit(model);
                }
                catch (Exception ex)
                {
                    if (!Exist(id))
                    {
                        return(BadRequest());
                    }
                    else
                    {
                        throw ex;
                    }
                }
            }

            return(Ok());
        }