public IEnumerable Delete(int id) { var rol = new daRoles("Eliminar rol"); bool valida = false; if (!ModelState.IsValid) { yield return(BadRequest(ModelState)); } var t = Task.Run(() => { valida = rol.Delete(id); } ); if (t.Wait(TimeSpan.FromSeconds(10))) { t.Dispose(); } yield return(Ok(valida)); }
public IEnumerable Put(eRoles roles) { var rol = new daRoles("Actualizar roles"); bool valida = false; if (!ModelState.IsValid) { yield return(BadRequest(ModelState)); } var t = Task.Run(() => { valida = rol.Update(roles); } ); if (t.Wait(TimeSpan.FromSeconds(10))) { t.Dispose(); } yield return(Ok(valida)); }